diff --git a/Content.Server/Commands/MakeSentientCommand.cs b/Content.Server/Commands/MakeSentientCommand.cs index e180b17a60..888d93049c 100644 --- a/Content.Server/Commands/MakeSentientCommand.cs +++ b/Content.Server/Commands/MakeSentientCommand.cs @@ -43,6 +43,11 @@ namespace Content.Server.Commands return; } + MakeSentient(entity); + } + + public static void MakeSentient(IEntity entity) + { if(entity.HasComponent()) entity.RemoveComponent(); diff --git a/Content.Server/GameObjects/Components/Observer/GhostRoleMobSpawnerComponent.cs b/Content.Server/GameObjects/Components/Observer/GhostRoleMobSpawnerComponent.cs index 06d824c0fa..632ec9eb81 100644 --- a/Content.Server/GameObjects/Components/Observer/GhostRoleMobSpawnerComponent.cs +++ b/Content.Server/GameObjects/Components/Observer/GhostRoleMobSpawnerComponent.cs @@ -1,4 +1,5 @@ using System; +using Content.Server.Commands; using Content.Server.GameObjects.Components.Mobs; using Content.Server.Players; using JetBrains.Annotations; @@ -18,9 +19,12 @@ namespace Content.Server.GameObjects.Components.Observer public override string Name => "GhostRoleMobSpawner"; - [ViewVariables] + [ViewVariables(VVAccess.ReadWrite)] private bool _deleteOnSpawn = true; + [ViewVariables(VVAccess.ReadWrite)] + private bool _makeSentient = true; + [ViewVariables(VVAccess.ReadWrite)] private int _availableTakeovers = 1; @@ -35,6 +39,7 @@ namespace Content.Server.GameObjects.Components.Observer serializer.DataField(this, x => x.Prototype, "prototype", null); serializer.DataField(ref _deleteOnSpawn, "deleteOnSpawn", true); + serializer.DataField(ref _makeSentient, "makeSentient", true); serializer.DataField(ref _availableTakeovers, "availableTakeovers", 1); } @@ -48,7 +53,11 @@ namespace Content.Server.GameObjects.Components.Observer var mob = Owner.EntityManager.SpawnEntity(Prototype, Owner.Transform.Coordinates); + if(_makeSentient) + MakeSentientCommand.MakeSentient(mob); + mob.EnsureComponent(); + session.ContentData().Mind.TransferTo(mob); if (++_currentTakeovers < _availableTakeovers) return true;