2022-10-23 00:46:28 +02:00
|
|
|
using Content.Server.Body.Systems;
|
2021-11-01 23:32:58 -05:00
|
|
|
using Content.Shared.Administration;
|
|
|
|
|
using Robust.Shared.Console;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Administration.Commands
|
|
|
|
|
{
|
2022-09-14 17:02:38 -07:00
|
|
|
[AdminCommand(AdminFlags.Admin)]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class RemoveBodyPartCommand : IConsoleCommand
|
2021-11-01 23:32:58 -05:00
|
|
|
{
|
|
|
|
|
public string Command => "rmbodypart";
|
|
|
|
|
public string Description => "Removes a given entity from it's containing body, if any.";
|
|
|
|
|
public string Help => "Usage: rmbodypart <uid>";
|
|
|
|
|
|
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Length != 1)
|
|
|
|
|
{
|
|
|
|
|
shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!EntityUid.TryParse(args[0], out var entityUid))
|
|
|
|
|
{
|
|
|
|
|
shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
2022-10-23 00:46:28 +02:00
|
|
|
var bodySystem = entityManager.System<BodySystem>();
|
2021-11-01 23:32:58 -05:00
|
|
|
|
2022-10-23 00:46:28 +02:00
|
|
|
if (bodySystem.DropPart(entityUid))
|
2021-11-01 23:32:58 -05:00
|
|
|
{
|
2022-10-23 00:46:28 +02:00
|
|
|
shell.WriteLine($"Removed body part {entityManager.ToPrettyString(entityUid)}.");
|
2021-11-01 23:32:58 -05:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
shell.WriteError("Was not a body part, or did not have a parent.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|