diff --git a/Content.Server/Mind/MindHelpers.cs b/Content.Server/Mind/MindHelpers.cs deleted file mode 100644 index cc92ac1cdb..0000000000 --- a/Content.Server/Mind/MindHelpers.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Content.Server.GameTicking; -using Content.Server.Players; -using Robust.Server.Player; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; - -namespace Content.Server.Mind -{ - internal static class MindHelpers - { - internal static void SendToGhost(this IEntity entity, bool canReturn=false) - { - var mind = entity.PlayerSession()?.ContentData()?.Mind; - - if (mind == null) return; - - EntitySystem.Get().OnGhostAttempt(mind, canReturn); - } - } -} diff --git a/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs b/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs index a8405e6b96..384ec59538 100644 --- a/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs +++ b/Content.Server/Morgue/Components/CrematoriumEntityStorageComponent.cs @@ -11,6 +11,7 @@ using Content.Shared.Morgue; using Content.Shared.Popups; using Content.Shared.Sound; using Content.Shared.Standing; +using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.Audio; using Robust.Shared.GameObjects; @@ -131,9 +132,7 @@ namespace Content.Server.Morgue.Components SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat) { - var mind = victim.PlayerSession()?.ContentData()?.Mind; - - if (mind != null) + if (victim.TryGetComponent(out ActorComponent? actor) && actor.PlayerSession.ContentData()?.Mind is {} mind) { EntitySystem.Get().OnGhostAttempt(mind, false); mind.OwnedEntity?.PopupMessage(Loc.GetString("crematorium-entity-storage-component-suicide-message")); diff --git a/Content.Server/Recycling/Components/RecyclerComponent.cs b/Content.Server/Recycling/Components/RecyclerComponent.cs index e7d03939c3..d1cd624b4b 100644 --- a/Content.Server/Recycling/Components/RecyclerComponent.cs +++ b/Content.Server/Recycling/Components/RecyclerComponent.cs @@ -1,6 +1,7 @@ using Content.Server.Act; using Content.Server.Chat.Managers; using Content.Server.GameTicking; +using Content.Server.Mind.Components; using Content.Server.Players; using Content.Server.Popups; using Content.Shared.Body.Components; @@ -47,9 +48,7 @@ namespace Content.Server.Recycling.Components SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat) { - var mind = victim.PlayerSession()?.ContentData()?.Mind; - - if (mind != null) + if (victim.TryGetComponent(out ActorComponent? actor) && actor.PlayerSession.ContentData()?.Mind is {} mind) { EntitySystem.Get().OnGhostAttempt(mind, false); mind.OwnedEntity?.PopupMessage(Loc.GetString("recycler-component-suicide-message"));