Remove ghost role component references (#15262)

This commit is contained in:
DrSmugleaf
2023-04-12 06:32:14 -07:00
committed by GitHub
parent 284f6b99b9
commit 9146374e39
30 changed files with 258 additions and 182 deletions

View File

@@ -1,36 +1,11 @@
using Content.Server.Mind.Commands;
using Content.Server.Mind.Components;
using Robust.Server.Player;
namespace Content.Server.Ghost.Roles.Components
{
/// <summary>
/// Allows a ghost to take over the Owner entity.
/// </summary>
[RegisterComponent, ComponentReference(typeof(GhostRoleComponent))]
public sealed class GhostTakeoverAvailableComponent : GhostRoleComponent
[RegisterComponent]
[Access(typeof(GhostRoleSystem))]
public sealed class GhostTakeoverAvailableComponent : Component
{
public override bool Take(IPlayerSession session)
{
if (Taken)
return false;
Taken = true;
var mind = Owner.EnsureComponent<MindComponent>();
if (mind.HasMind)
return false;
if (MakeSentient)
MakeSentientCommand.MakeSentient(Owner, IoCManager.Resolve<IEntityManager>(), AllowMovement, AllowSpeech);
var ghostRoleSystem = EntitySystem.Get<GhostRoleSystem>();
ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, Owner, Owner, this);
ghostRoleSystem.UnregisterGhostRole(this);
return true;
}
}
}