Allow GhostTakeoverAvailable to use MakeSentient (#5616)
This commit is contained in:
@@ -14,6 +14,12 @@ namespace Content.Server.Ghost.Roles.Components
|
|||||||
|
|
||||||
[DataField("rules")] private string _roleRules = "";
|
[DataField("rules")] private string _roleRules = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the <see cref="MakeSentientCommand"/> should run on the mob.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("makeSentient")]
|
||||||
|
protected bool MakeSentient = true;
|
||||||
|
|
||||||
// We do this so updating RoleName and RoleDescription in VV updates the open EUIs.
|
// We do this so updating RoleName and RoleDescription in VV updates the open EUIs.
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ namespace Content.Server.Ghost.Roles.Components
|
|||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("deleteOnSpawn")]
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("deleteOnSpawn")]
|
||||||
private bool _deleteOnSpawn = true;
|
private bool _deleteOnSpawn = true;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("makeSentient")]
|
|
||||||
private bool _makeSentient = true;
|
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("availableTakeovers")]
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("availableTakeovers")]
|
||||||
private int _availableTakeovers = 1;
|
private int _availableTakeovers = 1;
|
||||||
|
|
||||||
@@ -41,12 +38,12 @@ namespace Content.Server.Ghost.Roles.Components
|
|||||||
if (Taken)
|
if (Taken)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(string.IsNullOrEmpty(Prototype))
|
if (string.IsNullOrEmpty(Prototype))
|
||||||
throw new NullReferenceException("Prototype string cannot be null or empty!");
|
throw new NullReferenceException("Prototype string cannot be null or empty!");
|
||||||
|
|
||||||
var mob = Owner.EntityManager.SpawnEntity(Prototype, Owner.Transform.Coordinates);
|
var mob = Owner.EntityManager.SpawnEntity(Prototype, Owner.Transform.Coordinates);
|
||||||
|
|
||||||
if(_makeSentient)
|
if (MakeSentient)
|
||||||
MakeSentientCommand.MakeSentient(mob.Uid, Owner.EntityManager);
|
MakeSentientCommand.MakeSentient(mob.Uid, Owner.EntityManager);
|
||||||
|
|
||||||
mob.EnsureComponent<MindComponent>();
|
mob.EnsureComponent<MindComponent>();
|
||||||
@@ -62,9 +59,7 @@ namespace Content.Server.Ghost.Roles.Components
|
|||||||
if (_deleteOnSpawn)
|
if (_deleteOnSpawn)
|
||||||
Owner.Delete();
|
Owner.Delete();
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Content.Server.Mind.Commands;
|
||||||
using Content.Server.Mind.Components;
|
using Content.Server.Mind.Components;
|
||||||
using Content.Server.Players;
|
using Content.Server.Players;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
@@ -27,6 +28,9 @@ namespace Content.Server.Ghost.Roles.Components
|
|||||||
if (mind.HasMind)
|
if (mind.HasMind)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (MakeSentient)
|
||||||
|
MakeSentientCommand.MakeSentient(OwnerUid, Owner.EntityManager);
|
||||||
|
|
||||||
var ghostRoleSystem = EntitySystem.Get<GhostRoleSystem>();
|
var ghostRoleSystem = EntitySystem.Get<GhostRoleSystem>();
|
||||||
ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, OwnerUid, OwnerUid, this);
|
ghostRoleSystem.GhostRoleInternalCreateMindAndTransfer(session, OwnerUid, OwnerUid, this);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user