mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-04 02:57:08 +02:00
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using Robust.Server.GameObjects;
|
|
using Robust.Shared.Console;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
|
|
namespace Robust.Server.Console.Commands
|
|
{
|
|
public sealed class DeleteCommand : IConsoleCommand
|
|
{
|
|
public string Command => "delete";
|
|
public string Description => "Deletes the entity with the specified ID.";
|
|
public string Help => "delete <entity UID>";
|
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
if (args.Length != 1)
|
|
{
|
|
shell.WriteLine("You should provide exactly one argument.");
|
|
return;
|
|
}
|
|
|
|
var ent = IoCManager.Resolve<IServerEntityManager>();
|
|
|
|
if (!EntityUid.TryParse(args[0], out var entity))
|
|
{
|
|
shell.WriteLine("Invalid entity UID.");
|
|
return;
|
|
}
|
|
|
|
if (!ent.EntityExists(entity))
|
|
{
|
|
shell.WriteLine("That entity does not exist.");
|
|
return;
|
|
}
|
|
|
|
ent.DeleteEntity(entity);
|
|
}
|
|
}
|
|
}
|