Restrict ghost role speech/movement to component flags (#11183)
This commit is contained in:
@@ -63,6 +63,14 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
}
|
||||
}
|
||||
|
||||
[DataField("allowSpeech")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool AllowSpeech { get; set; } = true;
|
||||
|
||||
[DataField("allowMovement")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool AllowMovement { get; set; }
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public bool Taken { get; set; }
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
_entMan.EventBus.RaiseLocalEvent(mob, spawnedEvent, false);
|
||||
|
||||
if (MakeSentient)
|
||||
MakeSentientCommand.MakeSentient(mob, _entMan);
|
||||
MakeSentientCommand.MakeSentient(mob, _entMan, AllowMovement, AllowSpeech);
|
||||
|
||||
mob.EnsureComponent<MindComponent>();
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
return false;
|
||||
|
||||
if (MakeSentient)
|
||||
MakeSentientCommand.MakeSentient(Owner, IoCManager.Resolve<IEntityManager>());
|
||||
MakeSentientCommand.MakeSentient(Owner, IoCManager.Resolve<IEntityManager>(), AllowMovement, AllowSpeech);
|
||||
|
||||
var ghostRoleSystem = EntitySystem.Get<GhostRoleSystem>();
|
||||
ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, Owner, Owner, this);
|
||||
|
||||
@@ -39,19 +39,27 @@ namespace Content.Server.Mind.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
MakeSentient(entId, entityManager);
|
||||
MakeSentient(entId, entityManager, true, true);
|
||||
}
|
||||
|
||||
public static void MakeSentient(EntityUid uid, IEntityManager entityManager)
|
||||
public static void MakeSentient(EntityUid uid, IEntityManager entityManager, bool allowMovement = true, bool allowSpeech = true)
|
||||
{
|
||||
entityManager.RemoveComponent<NPCComponent>(uid);
|
||||
|
||||
entityManager.EnsureComponent<MindComponent>(uid);
|
||||
entityManager.EnsureComponent<InputMoverComponent>(uid);
|
||||
entityManager.EnsureComponent<MobMoverComponent>(uid);
|
||||
entityManager.EnsureComponent<MovementSpeedModifierComponent>(uid);
|
||||
entityManager.EnsureComponent<SharedSpeechComponent>(uid);
|
||||
entityManager.EnsureComponent<SharedEmotingComponent>(uid);
|
||||
if (allowMovement)
|
||||
{
|
||||
entityManager.EnsureComponent<InputMoverComponent>(uid);
|
||||
entityManager.EnsureComponent<MobMoverComponent>(uid);
|
||||
entityManager.EnsureComponent<MovementSpeedModifierComponent>(uid);
|
||||
}
|
||||
|
||||
if (allowSpeech)
|
||||
{
|
||||
entityManager.EnsureComponent<SharedSpeechComponent>(uid);
|
||||
entityManager.EnsureComponent<SharedEmotingComponent>(uid);
|
||||
}
|
||||
|
||||
entityManager.EnsureComponent<ExaminerComponent>(uid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ public sealed class RandomSentience : StationEventSystem
|
||||
if (toMakeSentient-- == 0)
|
||||
break;
|
||||
|
||||
MakeSentientCommand.MakeSentient(target.Owner, EntityManager);
|
||||
EntityManager.RemoveComponent<SentienceTargetComponent>(target.Owner);
|
||||
var comp = EntityManager.AddComponent<GhostTakeoverAvailableComponent>(target.Owner);
|
||||
comp.RoleName = EntityManager.GetComponent<MetaDataComponent>(target.Owner).EntityName;
|
||||
|
||||
Reference in New Issue
Block a user