Files

33 lines
1.1 KiB
C#
Raw Permalink Normal View History

2022-05-18 00:05:22 -04:00
using Content.Server.Polymorph.Components;
using Content.Server.Polymorph.Systems;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands;
[AdminCommand(AdminFlags.Fun)]
public sealed class AddPolymorphActionCommand : LocalizedEntityCommands
2022-05-18 00:05:22 -04:00
{
[Dependency] private readonly PolymorphSystem _polySystem = default!;
public override string Command => "addpolymorphaction";
2022-05-18 00:05:22 -04:00
public override void Execute(IConsoleShell shell, string argStr, string[] args)
2022-05-18 00:05:22 -04:00
{
if (args.Length != 2)
{
shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));
return;
}
if (!NetEntity.TryParse(args[0], out var entityUidNet) || !EntityManager.TryGetEntity(entityUidNet, out var entityUid))
2022-05-18 00:05:22 -04:00
{
shell.WriteError(Loc.GetString("shell-could-not-find-entity-with-uid", ("uid", args[0])));
2022-05-18 00:05:22 -04:00
return;
}
var polymorphable = EntityManager.EnsureComponent<PolymorphableComponent>(entityUid.Value);
_polySystem.CreatePolymorphAction(args[1], (entityUid.Value, polymorphable));
2022-05-18 00:05:22 -04:00
}
}