@@ -6,17 +6,13 @@ using Robust.Shared.Console;
|
||||
namespace Content.Server.Administration.Commands;
|
||||
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
public sealed class AddPolymorphActionCommand : IConsoleCommand
|
||||
public sealed class AddPolymorphActionCommand : LocalizedEntityCommands
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly PolymorphSystem _polySystem = default!;
|
||||
|
||||
public string Command => "addpolymorphaction";
|
||||
public override string Command => "addpolymorphaction";
|
||||
|
||||
public string Description => Loc.GetString("add-polymorph-action-command-description");
|
||||
|
||||
public string Help => Loc.GetString("add-polymorph-action-command-help-text");
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
@@ -24,15 +20,13 @@ public sealed class AddPolymorphActionCommand : IConsoleCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if (!NetEntity.TryParse(args[0], out var entityUidNet) || !_entityManager.TryGetEntity(entityUidNet, out var entityUid))
|
||||
if (!NetEntity.TryParse(args[0], out var entityUidNet) || !EntityManager.TryGetEntity(entityUidNet, out var entityUid))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("shell-entity-uid-must-be-number"));
|
||||
shell.WriteError(Loc.GetString("shell-could-not-find-entity-with-uid", ("uid", args[0])));
|
||||
return;
|
||||
}
|
||||
|
||||
var polySystem = _entityManager.EntitySysManager.GetEntitySystem<PolymorphSystem>();
|
||||
|
||||
var polymorphable = _entityManager.EnsureComponent<PolymorphableComponent>(entityUid.Value);
|
||||
polySystem.CreatePolymorphAction(args[1], (entityUid.Value, polymorphable));
|
||||
var polymorphable = EntityManager.EnsureComponent<PolymorphableComponent>(entityUid.Value);
|
||||
_polySystem.CreatePolymorphAction(args[1], (entityUid.Value, polymorphable));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user