private void SendBodyPartListToUser(AfterInteractEventArgs eventArgs, IBody body) { // Create dictionary to send to client (text to be shown : data sent back if selected) var toSend = new Dictionary <string, int>(); foreach (var(key, value) in body.Parts) { // For each limb in the target, add it to our cache if it is a valid option. if (value.CanAddMechanism(this)) { OptionsCache.Add(IdHash, value); toSend.Add(key + ": " + value.Name, IdHash++); } } if (OptionsCache.Count > 0 && eventArgs.User.TryGetComponent(out IActorComponent? actor)) { OpenSurgeryUI(actor.playerSession); UpdateSurgeryUIBodyPartRequest(actor.playerSession, toSend); PerformerCache = eventArgs.User; BodyCache = body; } else // If surgery cannot be performed, show message saying so. { eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("You see no way to install the {0}.", Owner.Name)); } }
private void SendBodyPartListToUser(AfterInteractEventArgs eventArgs, SharedBodyComponent body) { // Create dictionary to send to client (text to be shown : data sent back if selected) var toSend = new Dictionary <string, int>(); foreach (var(part, slot) in body.Parts) { // For each limb in the target, add it to our cache if it is a valid option. if (part.CanAddMechanism(this)) { OptionsCache.Add(IdHash, slot); toSend.Add(part + ": " + part.Name, IdHash++); } } if (OptionsCache.Count > 0 && _entities.TryGetComponent(eventArgs.User, out ActorComponent? actor)) { OpenSurgeryUI(actor.PlayerSession); UpdateSurgeryUIBodyPartRequest(actor.PlayerSession, toSend); PerformerCache = eventArgs.User; BodyCache = body; } else // If surgery cannot be performed, show message saying so. { eventArgs.Target?.PopupMessage(eventArgs.User, Loc.GetString("mechanism-component-no-way-to-install-message", ("partName", Name: _entities.GetComponent <MetaDataComponent>(Owner).EntityName))); } }