Cleanup AddPolymorphActionCommand and LEC conversion. (#38853)

commit
This commit is contained in:
Kyle Tyo
2025-09-03 16:16:43 -04:00
committed by GitHub
parent 3e63e4590d
commit f5a980edc2
3 changed files with 10 additions and 22 deletions

View File

@@ -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));
}
}

View File

@@ -1,8 +0,0 @@
polymorph-command-description = For when you need someone to stop being a person. Takes an entity and a polymorph prototype.
polymorph-command-help-text = polymorph <id> <polymorph prototype>
add-polymorph-action-command-description = Takes an entity and gives them a voluntary polymorph.
add-polymorph-action-command-help-text = addpolymorphaction <id> <polymorph prototype>
polymorph-not-valid-prototype-error = Polymorph prototype is not valid.

View File

@@ -0,0 +1,2 @@
cmd-addpolymorphaction-desc = Takes an entity and gives them a voluntary polymorph.
cmd-addpolymorphaction-help = Usage: addpolymorphaction <id> <polymorph prototype>