Tweaks suicide to be a little more personal. (#1887)
* Copied code from ClimableComponent.cs to make Welder suicides way better * ass nath * Adds other types of suicide and addresses review * fixes conflicts * Welder updates * Welder fixes x2 * themselves * Fix typo * Remove crate textures * Merge remote-tracking branch 'upstream/master' into pr/1887 Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
@@ -5,9 +5,11 @@ using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Server.GameObjects.Components.Observer;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Observer;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.Interfaces.Console;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Enums;
|
||||
@@ -116,6 +118,9 @@ namespace Content.Server.Chat
|
||||
|
||||
internal class SuicideCommand : IClientCommand
|
||||
{
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager = default!;
|
||||
|
||||
public string Command => "suicide";
|
||||
|
||||
public string Description => "Commits suicide";
|
||||
@@ -186,12 +191,29 @@ namespace Content.Server.Chat
|
||||
}
|
||||
}
|
||||
// Default suicide, bite your tongue
|
||||
chat.EntityMe(owner, Loc.GetString("is attempting to bite {0:their} own tongue, looks like {0:theyre} trying to commit suicide!", owner)); //TODO: theyre macro
|
||||
PopupMessageOtherClientsInRange(owner, Loc.GetString("{0:theName} is attempting to bite {0:their} own tongue!", owner), 15);
|
||||
_notifyManager.PopupMessage(owner, owner, Loc.GetString("You attempt to bite your own tongue!"));
|
||||
dmgComponent.ChangeDamage(DamageType.Piercing, 500, true, owner);
|
||||
|
||||
// Prevent the player from returning to the body. Yes, this is an ugly hack.
|
||||
var ghost = new Ghost(){CanReturn = false};
|
||||
ghost.Execute(shell, player, Array.Empty<string>());
|
||||
}
|
||||
private void PopupMessageOtherClientsInRange(IEntity source, string message, int maxReceiveDistance)
|
||||
{
|
||||
var viewers = _playerManager.GetPlayersInRange(source.Transform.GridPosition, maxReceiveDistance);
|
||||
|
||||
foreach (var viewer in viewers)
|
||||
{
|
||||
var viewerEntity = viewer.AttachedEntity;
|
||||
|
||||
if (viewerEntity == null || source == viewerEntity)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
source.PopupMessage(viewer.AttachedEntity, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,16 @@ using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Server.GameObjects.EntitySystems.DoAfter;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -31,6 +35,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
|
||||
public override string Name => "Welder";
|
||||
public override uint? NetID => ContentNetIDs.WELDER;
|
||||
@@ -256,11 +261,13 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
if (TryWeld(5, victim, silent: true))
|
||||
{
|
||||
PlaySoundCollection(WeldSoundCollection);
|
||||
chat.EntityMe(victim, Loc.GetString("welds {0:their} every orifice closed! It looks like {0:theyre} trying to commit suicide!", victim));
|
||||
PopupMessageOtherClientsInRange(victim, Loc.GetString("{0:theName} welds {0:their} every orifice closed! It looks like {0:theyre} trying to commit suicide!", victim), 15);
|
||||
_notifyManager.PopupMessage(victim, victim, Loc.GetString("You weld your every orifice closed!"));
|
||||
return SuicideKind.Heat;
|
||||
}
|
||||
|
||||
chat.EntityMe(victim, Loc.GetString("bashes {0:themselves} with the {1}!", victim, Owner.Name));
|
||||
PopupMessageOtherClientsInRange(victim, Loc.GetString("{0:theName} bashes themselves with the unlit welding torch!", victim), 15);
|
||||
_notifyManager.PopupMessage(victim, victim, Loc.GetString("You bash yourself with the unlit welding torch!"));
|
||||
return SuicideKind.Blunt;
|
||||
}
|
||||
|
||||
@@ -268,5 +275,22 @@ namespace Content.Server.GameObjects.Components.Interactable
|
||||
{
|
||||
Dirty();
|
||||
}
|
||||
|
||||
private void PopupMessageOtherClientsInRange(IEntity source, string message, int maxReceiveDistance)
|
||||
{
|
||||
var viewers = _playerManager.GetPlayersInRange(source.Transform.GridPosition, maxReceiveDistance);
|
||||
|
||||
foreach (var viewer in viewers)
|
||||
{
|
||||
var viewerEntity = viewer.AttachedEntity;
|
||||
|
||||
if (viewerEntity == null || source == viewerEntity)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
source.PopupMessage(viewer.AttachedEntity, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ using Robust.Server.GameObjects.Components.Container;
|
||||
using Robust.Server.GameObjects.Components.UserInterface;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Server.Interfaces.GameObjects;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
@@ -44,8 +45,9 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly RecipeManager _recipeManager = default!;
|
||||
[Dependency] private readonly IServerNotifyManager _notifyManager = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
|
||||
#region YAMLSERIALIZE
|
||||
#region YAMLSERIALIZE
|
||||
private int _cookTimeDefault;
|
||||
private int _cookTimeMultiplier; //For upgrades and stuff I guess?
|
||||
private string _badRecipeName = "";
|
||||
@@ -498,12 +500,29 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
headCount++;
|
||||
}
|
||||
}
|
||||
chat.EntityMe(victim, Loc.GetPluralString("is trying to cook {0:their} head!", "is trying to cook {0:their} heads!", headCount, victim));
|
||||
PopupMessageOtherClientsInRange(victim, Loc.GetString("{0:theName} is trying to cook {0:their} head!", victim), 15);
|
||||
_notifyManager.PopupMessage(victim, victim, Loc.GetString("You cook your head!"));
|
||||
_currentCookTimerTime = 10;
|
||||
ClickSound();
|
||||
_uiDirty = true;
|
||||
wzhzhzh();
|
||||
return SuicideKind.Heat;
|
||||
}
|
||||
private void PopupMessageOtherClientsInRange(IEntity source, string message, int maxReceiveDistance)
|
||||
{
|
||||
var viewers = _playerManager.GetPlayersInRange(source.Transform.GridPosition, maxReceiveDistance);
|
||||
|
||||
foreach (var viewer in viewers)
|
||||
{
|
||||
var viewerEntity = viewer.AttachedEntity;
|
||||
|
||||
if (viewerEntity == null || source == viewerEntity)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
source.PopupMessage(viewer.AttachedEntity, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user