]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Cleanup AddPolymorphActionCommand and LEC conversion. (#38853)
authorKyle Tyo <36606155+VerinSenpai@users.noreply.github.com>
Wed, 3 Sep 2025 20:16:43 +0000 (16:16 -0400)
committerGitHub <noreply@github.com>
Wed, 3 Sep 2025 20:16:43 +0000 (22:16 +0200)
commit

Content.Server/Administration/Commands/AddPolymorphActionCommand.cs
Resources/Locale/en-US/administration/commands/polymorph-command.ftl [deleted file]
Resources/Locale/en-US/commands/addpolymorphaction-command.ftl [new file with mode: 0644]

index b92cbfc0de9715e6b6b7c25715a2b46545e6e984..f089268beae1a24bb9f2c7207233cc90d4250957 100644 (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));
     }
 }
diff --git a/Resources/Locale/en-US/administration/commands/polymorph-command.ftl b/Resources/Locale/en-US/administration/commands/polymorph-command.ftl
deleted file mode 100644 (file)
index ef7d1b7..0000000
+++ /dev/null
@@ -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.
\ No newline at end of file
diff --git a/Resources/Locale/en-US/commands/addpolymorphaction-command.ftl b/Resources/Locale/en-US/commands/addpolymorphaction-command.ftl
new file mode 100644 (file)
index 0000000..72f2158
--- /dev/null
@@ -0,0 +1,2 @@
+cmd-addpolymorphaction-desc = Takes an entity and gives them a voluntary polymorph.
+cmd-addpolymorphaction-help = Usage: addpolymorphaction <id> <polymorph prototype>