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:
Swept
2020-08-29 11:12:21 +00:00
committed by GitHub
parent 566ed6b770
commit a57c5265be
3 changed files with 70 additions and 5 deletions

View File

@@ -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);
}
}
}
}