Files
tbd-station-14/Content.Server/Administration/Commands/ControlMob.cs
Brandon Hu 31c5d3555e fix(Commands): Improve Localization of commands. Standardize some behaviors. (#30362)
* I should be studying for school but that is sofucking boring, I will pass my class no matter, however getting an A might be a challenge. My gpa is important but is the tourture for 1 point of GPA worth it? The american government says yes but they are responsible for the majority of all genocides that have ever been conducted since the dawn of man

* ugh

* ugh
2024-08-11 19:46:57 +10:00

48 lines
1.5 KiB
C#

using Content.Server.Mind;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
{
[AdminCommand(AdminFlags.Fun)]
public sealed class ControlMob : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entities = default!;
public string Command => "controlmob";
public string Description => Loc.GetString("control-mob-command-description");
public string Help => Loc.GetString("control-mob-command-help-text");
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
return;
}
if (args.Length != 1)
{
shell.WriteLine(Loc.GetString("shell-wrong-arguments-number"));
return;
}
if (!int.TryParse(args[0], out var targetId))
{
shell.WriteLine(Loc.GetString("shell-argument-must-be-number"));
return;
}
var targetNet = new NetEntity(targetId);
if (!_entities.TryGetEntity(targetNet, out var target))
{
shell.WriteLine(Loc.GetString("shell-invalid-entity-id"));
return;
}
_entities.System<MindSystem>().ControlMob(player.UserId, target.Value);
}
}
}