using System.Linq;
using Content.Server.Ghost.Roles;
using Content.Server.Ghost.Roles.Components;
-using Content.Server.Mind.Commands;
+using Content.Server.Mind;
using Content.Server.Roles;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
var entMan = server.ResolveDependency<IServerEntityManager>();
var playerMan = server.ResolveDependency<IPlayerManager>();
- var mindSystem = entMan.EntitySysManager.GetEntitySystem<SharedMindSystem>();
+ var mindSystem = entMan.EntitySysManager.GetEntitySystem<MindSystem>();
EntityUid entity = default!;
EntityUid mindId = default!;
mob = entMan.SpawnEntity(null, new MapCoordinates());
- MakeSentientCommand.MakeSentient(mob, entMan);
+ mindSystem.MakeSentient(mob);
mobMindId = mindSystem.CreateMind(player.UserId, "Mindy McThinker the Second");
mobMind = entMan.GetComponent<MindComponent>(mobMindId);
using Content.Server.Disposal.Tube;
using Content.Server.EUI;
using Content.Server.Ghost.Roles;
-using Content.Server.Mind.Commands;
using Content.Server.Mind;
using Content.Server.Prayer;
using Content.Server.Silicons.Laws;
using Content.Shared.Database;
using Content.Shared.Examine;
using Content.Shared.GameTicking;
-using Content.Shared.Hands.Components;
using Content.Shared.Inventory;
using Content.Shared.Mind.Components;
using Content.Shared.Movement.Components;
Text = Loc.GetString("make-sentient-verb-get-data-text"),
Category = VerbCategory.Debug,
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/sentient.svg.192dpi.png")),
- Act = () => MakeSentientCommand.MakeSentient(args.Target, EntityManager),
+ Act = () => _mindSystem.MakeSentient(args.Target),
Impact = LogImpact.Medium
};
args.Verbs.Add(verb);
using Content.Server.Ghost.Roles.Events;
using Content.Shared.Ghost.Roles.Raffles;
using Content.Server.Ghost.Roles.UI;
-using Content.Server.Mind.Commands;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Content.Shared.Database;
RaiseLocalEvent(mob, spawnedEvent);
if (ghostRole.MakeSentient)
- MakeSentientCommand.MakeSentient(mob, EntityManager, ghostRole.AllowMovement, ghostRole.AllowSpeech);
+ _mindSystem.MakeSentient(mob, ghostRole.AllowMovement, ghostRole.AllowSpeech);
EnsureComp<MindContainerComponent>(mob);
}
if (ghostRole.MakeSentient)
- MakeSentientCommand.MakeSentient(uid, EntityManager, ghostRole.AllowMovement, ghostRole.AllowSpeech);
+ _mindSystem.MakeSentient(uid, ghostRole.AllowMovement, ghostRole.AllowSpeech);
GhostRoleInternalCreateMindAndTransfer(args.Player, uid, uid, ghostRole);
UnregisterGhostRole((uid, ghostRole));
using Content.Server.Administration;
using Content.Shared.Administration;
-using Content.Shared.Emoting;
-using Content.Shared.Examine;
-using Content.Shared.Mind.Components;
-using Content.Shared.Movement.Components;
-using Content.Shared.Speech;
using Robust.Shared.Console;
-namespace Content.Server.Mind.Commands
+namespace Content.Server.Mind.Commands;
+
+[AdminCommand(AdminFlags.Admin)]
+public sealed class MakeSentientCommand : LocalizedEntityCommands
{
- [AdminCommand(AdminFlags.Admin)]
- public sealed class MakeSentientCommand : IConsoleCommand
- {
- [Dependency] private readonly IEntityManager _entManager = default!;
+ [Dependency] private readonly MindSystem _mindSystem = default!;
- public string Command => "makesentient";
- public string Description => "Makes an entity sentient (able to be controlled by a player)";
- public string Help => "makesentient <entity id>";
+ public override string Command => "makesentient";
- public void Execute(IConsoleShell shell, string argStr, string[] args)
+ public override void Execute(IConsoleShell shell, string argStr, string[] args)
+ {
+ if (args.Length != 1)
{
- if (args.Length != 1)
- {
- shell.WriteLine("Wrong number of arguments.");
- return;
- }
-
- if (!NetEntity.TryParse(args[0], out var entNet) || !_entManager.TryGetEntity(entNet, out var entId))
- {
- shell.WriteLine("Invalid argument.");
- return;
- }
-
- if (!_entManager.EntityExists(entId))
- {
- shell.WriteLine("Invalid entity specified!");
- return;
- }
-
- MakeSentient(entId.Value, _entManager, true, true);
+ shell.WriteLine(Loc.GetString("shell-need-exactly-one-argument"));
+ return;
}
- public static void MakeSentient(EntityUid uid, IEntityManager entityManager, bool allowMovement = true, bool allowSpeech = true)
+ if (!NetEntity.TryParse(args[0], out var entNet) || !EntityManager.TryGetEntity(entNet, out var entId) || !EntityManager.EntityExists(entId))
{
- entityManager.EnsureComponent<MindContainerComponent>(uid);
- if (allowMovement)
- {
- entityManager.EnsureComponent<InputMoverComponent>(uid);
- entityManager.EnsureComponent<MobMoverComponent>(uid);
- entityManager.EnsureComponent<MovementSpeedModifierComponent>(uid);
- }
-
- if (allowSpeech)
- {
- entityManager.EnsureComponent<SpeechComponent>(uid);
- entityManager.EnsureComponent<EmotingComponent>(uid);
- }
-
- entityManager.EnsureComponent<ExaminerComponent>(uid);
+ shell.WriteLine(Loc.GetString("shell-could-not-find-entity-with-uid", ("uid", args[0])));
+ return;
}
+
+ _mindSystem.MakeSentient(entId.Value);
}
}
using Content.Server.Administration.Logs;
using Content.Server.GameTicking;
using Content.Server.Ghost;
-using Content.Server.Mind.Commands;
using Content.Shared.Database;
using Content.Shared.Ghost;
using Content.Shared.Mind;
return;
}
- MakeSentientCommand.MakeSentient(target, EntityManager);
+ MakeSentient(target);
TransferTo(mindId, target, ghostCheckOverride: true, mind: mind);
}
}
using Content.Server.Actions;
using Content.Server.Humanoid;
using Content.Server.Inventory;
-using Content.Server.Mind.Commands;
using Content.Server.Polymorph.Components;
-using Content.Shared.Actions;
-using Content.Shared.Actions.Components;
using Content.Shared.Buckle;
using Content.Shared.Coordinates;
using Content.Shared.Damage;
("child", Identity.Entity(child, EntityManager))),
child);
- MakeSentientCommand.MakeSentient(child, EntityManager);
+ _mindSystem.MakeSentient(child);
var polymorphedComp = Factory.GetComponent<PolymorphedEntityComponent>();
polymorphedComp.Parent = uid;
using Content.Server.Access.Systems;
using Content.Server.Humanoid;
using Content.Server.IdentityManagement;
-using Content.Server.Mind.Commands;
+using Content.Server.Mind;
using Content.Server.PDA;
using Content.Server.Station.Components;
using Content.Shared.Access.Components;
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
[Dependency] private readonly PdaSystem _pdaSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
+ [Dependency] private readonly MindSystem _mindSystem = default!;
/// <summary>
/// Attempts to spawn a player character onto the given station.
{
DebugTools.Assert(entity is null);
var jobEntity = Spawn(prototype.JobEntity, coordinates);
- MakeSentientCommand.MakeSentient(jobEntity, EntityManager);
+ _mindSystem.MakeSentient(jobEntity);
// Make sure custom names get handled, what is gameticker control flow whoopy.
if (loadout != null)
using Content.Server.IdentityManagement;
using Content.Server.Inventory;
using Content.Server.Mind;
-using Content.Server.Mind.Commands;
using Content.Server.NPC;
using Content.Server.NPC.HTN;
using Content.Server.NPC.Systems;
_popup.PopupEntity(Loc.GetString("zombie-transform", ("target", target)), target, PopupType.LargeCaution);
//Make it sentient if it's an animal or something
- MakeSentientCommand.MakeSentient(target, EntityManager);
+ _mind.MakeSentient(target);
//Make the zombie not die in the cold. Good for space zombies
if (TryComp<TemperatureComponent>(target, out var tempComp))
using System.Linq;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
+using Content.Shared.Emoting;
using Content.Shared.Examine;
using Content.Shared.GameTicking;
using Content.Shared.Humanoid;
using Content.Shared.Interaction.Events;
+using Content.Shared.Movement.Components;
using Content.Shared.Mind.Components;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Objectives.Systems;
using Content.Shared.Players;
+using Content.Shared.Speech;
+
using Content.Shared.Whitelist;
using Robust.Shared.Map;
using Robust.Shared.Network;
return allHumans;
}
+
+ /// <summary>
+ /// Give sentience to a target entity by attaching necessary components.
+ /// </summary>
+ /// <param name="uid">Uid of the target entity.</param>
+ /// <param name="allowMovement">Whether the target entity should be able to move.</param>
+ /// <param name="allowSpeech">Whether the target entity should be able to talk.</param>
+ public void MakeSentient(EntityUid uid, bool allowMovement = true, bool allowSpeech = true)
+ {
+ EnsureComp<MindContainerComponent>(uid);
+ if (allowMovement)
+ {
+ EnsureComp<InputMoverComponent>(uid);
+ EnsureComp<MobMoverComponent>(uid);
+ EnsureComp<MovementSpeedModifierComponent>(uid);
+ }
+
+ if (allowSpeech)
+ {
+ EnsureComp<SpeechComponent>(uid);
+ EnsureComp<EmotingComponent>(uid);
+ }
+
+ EnsureComp<ExaminerComponent>(uid);
+ }
}
/// <summary>
--- /dev/null
+cmd-makesentient-desc = Makes an entity sentient (able to be controlled by a player).
+cmd-makesentient-help = Usage: makesentient <entityUid>