Fix setmind command (#18799)

This commit is contained in:
Leon Friedrich
2023-08-07 19:18:39 +12:00
committed by GitHub
parent 6183640d02
commit 88b3417c3d
2 changed files with 13 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ namespace Content.Server.Administration.Commands
[AdminCommand(AdminFlags.Admin)]
sealed class SetMindCommand : IConsoleCommand
{
public string Command => "setmind";
public string Description => Loc.GetString("set-mind-command-description", ("requiredComponent", nameof(MindContainerComponent)));
@@ -19,7 +19,7 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 2)
if (args.Length < 2)
{
shell.WriteLine(Loc.GetString("shell-wrong-arguments-number"));
return;
@@ -31,6 +31,12 @@ namespace Content.Server.Administration.Commands
return;
}
bool ghostOverride = true;
if (args.Length > 2)
{
ghostOverride = bool.Parse(args[2]);
}
var entityManager = IoCManager.Resolve<IEntityManager>();
var eUid = new EntityUid(entityUid);
@@ -62,7 +68,7 @@ namespace Content.Server.Administration.Commands
}
var mindSystem = entityManager.System<MindSystem>();
var mind = playerCData.Mind;
if (mind == null)
{
@@ -70,7 +76,7 @@ namespace Content.Server.Administration.Commands
mind.CharacterName = entityManager.GetComponent<MetaDataComponent>(eUid).EntityName;
}
mindSystem.TransferTo(mind, eUid);
mindSystem.TransferTo(mind, eUid, ghostOverride);
}
}
}