Remove MindHelpers, stop using PlayerHelpers.

This commit is contained in:
Vera Aguilera Puerto
2021-11-21 17:59:27 +01:00
parent eeb0adc5cd
commit a666ddb045
3 changed files with 4 additions and 26 deletions

View File

@@ -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<GameTicker>().OnGhostAttempt(mind, canReturn);
}
}
}

View File

@@ -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<GameTicker>().OnGhostAttempt(mind, false);
mind.OwnedEntity?.PopupMessage(Loc.GetString("crematorium-entity-storage-component-suicide-message"));

View File

@@ -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<GameTicker>().OnGhostAttempt(mind, false);
mind.OwnedEntity?.PopupMessage(Loc.GetString("recycler-component-suicide-message"));