private void HandleReceiveBodyPart(int key) { if (PerformerCache == null || !PerformerCache.TryGetComponent(out IActorComponent? actor)) { return; } CloseSurgeryUI(actor.playerSession); if (BodyCache == null) { return; } // TODO: sanity checks to see whether user is in range, user is still able-bodied, target is still the same, etc etc if (!OptionsCache.TryGetValue(key, out var targetObject)) { BodyCache.Owner.PopupMessage(PerformerCache, Loc.GetString("You see no useful way to use the {0} anymore.", Owner.Name)); return; } var target = (IBodyPart)targetObject; var message = target.TryAddMechanism(this) ? Loc.GetString("You jam {0:theName} inside {1:them}.", Owner, PerformerCache) : Loc.GetString("You can't fit it in!"); BodyCache.Owner.PopupMessage(PerformerCache, message); // TODO: {1:theName} }
/// <summary> /// Called after the client chooses from a list of possible BodyParts that can be operated on. /// </summary> private void HandleReceiveBodyPart(int key) { if (PerformerCache == null || !_entities.TryGetComponent(PerformerCache.Value, out ActorComponent? actor)) { return; } CloseSurgeryUI(actor.PlayerSession); if (BodyCache == null) { return; } // TODO: sanity checks to see whether user is in range, user is still able-bodied, target is still the same, etc etc if (!OptionsCache.TryGetValue(key, out var targetObject)) { BodyCache.Owner.PopupMessage(PerformerCache.Value, Loc.GetString("mechanism-component-no-useful-way-to-use-message", ("partName", Name: _entities.GetComponent <MetaDataComponent>(Owner).EntityName))); return; } var target = (SharedBodyPartComponent)targetObject; var message = target.TryAddMechanism(this) ? Loc.GetString("mechanism-component-jam-inside-message", ("ownerName", Owner), ("them", PerformerCache)) : Loc.GetString("mechanism-component-cannot-fit-message"); BodyCache.Owner.PopupMessage(PerformerCache.Value, message); // TODO: {1:theName} }