Convert suicide to ecs (#8091)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
wrexbe
2022-05-12 05:05:16 -07:00
committed by GitHub
parent 6903209a31
commit 089e40a061
15 changed files with 362 additions and 282 deletions

View File

@@ -14,7 +14,7 @@ namespace Content.Server.Recycling.Components
// TODO: Add sound and safe beep
[RegisterComponent]
[Friend(typeof(RecyclerSystem))]
public sealed class RecyclerComponent : Component, ISuicideAct
public sealed class RecyclerComponent : Component
{
[Dependency] private readonly IEntityManager _entMan = default!;
@@ -44,27 +44,6 @@ namespace Content.Server.Recycling.Components
}
}
SuicideKind ISuicideAct.Suicide(EntityUid victim, IChatManager chat)
{
if (_entMan.TryGetComponent(victim, out ActorComponent? actor) &&
actor.PlayerSession.ContentData()?.Mind is { } mind)
{
EntitySystem.Get<GameTicker>().OnGhostAttempt(mind, false);
mind.OwnedEntity?.PopupMessage(Loc.GetString("recycler-component-suicide-message"));
}
victim.PopupMessageOtherClients(Loc.GetString("recycler-component-suicide-message-others",
("victim", victim)));
if (_entMan.TryGetComponent<SharedBodyComponent?>(victim, out var body))
{
body.Gib(true);
}
EntitySystem.Get<RecyclerSystem>().Bloodstain(this);
return SuicideKind.Bloodloss;
}
/// <summary>
/// Default sound to play when recycling
/// </summary>