SuicideKind ISuicideAct.Suicide(EntityUid victim, IChatManager chat) { // check that victim even have head if (_entMan.TryGetComponent <SharedBodyComponent?>(victim, out var body) && body.HasPartOfType(BodyPartType.Head)) { var othersMessage = Loc.GetString("toilet-component-suicide-head-message-others", ("victim", Name: _entMan.GetComponent <MetaDataComponent>(victim).EntityName), ("owner", Name: _entMan.GetComponent <MetaDataComponent>(Owner).EntityName)); victim.PopupMessageOtherClients(othersMessage); var selfMessage = Loc.GetString("toilet-component-suicide-head-message", ("owner", Name: _entMan.GetComponent <MetaDataComponent>(Owner).EntityName)); victim.PopupMessage(selfMessage); return(SuicideKind.Asphyxiation); } else { var othersMessage = Loc.GetString("toilet-component-suicide-message-others", ("victim", Name: _entMan.GetComponent <MetaDataComponent>(victim).EntityName), ("owner", Name: _entMan.GetComponent <MetaDataComponent>(Owner).EntityName)); victim.PopupMessageOtherClients(othersMessage); var selfMessage = Loc.GetString("toilet-component-suicide-message", ("owner", Name: _entMan.GetComponent <MetaDataComponent>(Owner).EntityName)); victim.PopupMessage(selfMessage); return(SuicideKind.Blunt); } }
// ECS this out!, Handleable SuicideEvent? SuicideKind ISuicideAct.Suicide(EntityUid victim, IChatManager chat) { var othersMessage = Loc.GetString("comp-kitchen-spike-suicide-other", ("victim", victim)); victim.PopupMessageOtherClients(othersMessage); var selfMessage = Loc.GetString("comp-kitchen-spike-suicide-self"); victim.PopupMessage(selfMessage); return(SuicideKind.Piercing); }
SuicideKind ISuicideAct.Suicide(EntityUid victim, IChatManager chat) { var headCount = 0; if (_entities.TryGetComponent <SharedBodyComponent?>(victim, out var body)) { var headSlots = body.GetSlotsOfType(BodyPartType.Head); foreach (var slot in headSlots) { var part = slot.Part; if (part == null || !body.TryDropPart(slot, out var dropped)) { continue; } foreach (var droppedPart in dropped.Values) { if (droppedPart.PartType != BodyPartType.Head) { continue; } _storage.Insert(droppedPart.Owner); headCount++; } } } var othersMessage = headCount > 1 ? Loc.GetString("microwave-component-suicide-multi-head-others-message", ("victim", victim)) : Loc.GetString("microwave-component-suicide-others-message", ("victim", victim)); victim.PopupMessageOtherClients(othersMessage); var selfMessage = headCount > 1 ? Loc.GetString("microwave-component-suicide-multi-head-message") : Loc.GetString("microwave-component-suicide-message"); victim.PopupMessage(selfMessage); _currentCookTimerTime = 10; ClickSound(); UIDirty = true; Wzhzhzh(); return(SuicideKind.Heat); }
/// <summary> /// If not handled, does the default suicide, which is biting your own tongue /// </summary> private static void DefaultSuicideHandler(EntityUid victim, SuicideEvent suicideEvent) { if (suicideEvent.Handled) { return; } var othersMessage = Loc.GetString("suicide-command-default-text-others", ("name", victim)); victim.PopupMessageOtherClients(othersMessage); var selfMessage = Loc.GetString("suicide-command-default-text-self"); victim.PopupMessage(selfMessage); suicideEvent.SetHandled(SuicideKind.Bloodloss); }
/// <summary> /// Pops up a message at the given entity's location for everyone, /// including itself, to see. /// </summary> /// <param name="source">The entity above which to show the message.</param> /// <param name="message">The message to be seen.</param> /// <param name="playerManager"> /// The instance of player manager to use, will be resolved automatically /// if null. /// </param> /// <param name="range"> /// The range in which to search for players, defaulting to one screen. /// </param> public static void PopupMessageEveryone(this EntityUid source, string message, IPlayerManager?playerManager = null, int range = 15) { source.PopupMessage(message); source.PopupMessageOtherClients(message); }