Remove ghost role component references (#15262)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user