]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Convert DumpReagentGuideText command to LEC. (#38569)
authorKyle Tyo <36606155+VerinSenpai@users.noreply.github.com>
Wed, 25 Jun 2025 20:02:01 +0000 (16:02 -0400)
committerGitHub <noreply@github.com>
Wed, 25 Jun 2025 20:02:01 +0000 (22:02 +0200)
* commit

* revert linq conversion

Content.Server/Chemistry/Commands/DumpReagentGuideText.cs
Resources/Locale/en-US/commands/dump-reagent-guide-text-command.ftl [new file with mode: 0644]

index 563708b8f36c0e126c244b6be6e7f54a4e61da17..a70c2196abadb7845cec712472af2ee3dc77e494 100644 (file)
@@ -7,32 +7,31 @@ using Robust.Shared.Prototypes;
 namespace Content.Server.Chemistry.Commands;
 
 [AdminCommand(AdminFlags.Debug)]
-public sealed class DumpReagentGuideText : IConsoleCommand
+public sealed class DumpReagentGuideText : LocalizedEntityCommands
 {
     [Dependency] private readonly IPrototypeManager _prototype = default!;
-    [Dependency] private readonly IEntitySystemManager _entSys = default!;
 
-    public string Command => "dumpreagentguidetext";
-    public string Description => "Dumps the guidebook text for a reagent to the console";
-    public string Help => "dumpreagentguidetext <reagent>";
+    public override string Command => "dumpreagentguidetext";
 
-    public void Execute(IConsoleShell shell, string argStr, string[] args)
+    public override void Execute(IConsoleShell shell, string argStr, string[] args)
     {
         if (args.Length != 1)
         {
-            shell.WriteError("Must have only 1 argument");
+            shell.WriteError(Loc.GetString($"shell-need-exactly-one-argument"));
             return;
         }
 
         if (!_prototype.TryIndex<ReagentPrototype>(args[0], out var reagent))
         {
-            shell.WriteError($"Invalid prototype: {args[0]}");
+            shell.WriteError(Loc.GetString($"shell-argument-must-be-prototype",
+                ("index", args[0]),
+                ("prototype", nameof(ReagentPrototype))));
             return;
         }
 
         if (reagent.Metabolisms is null)
         {
-            shell.WriteLine("Nothing to dump.");
+            shell.WriteLine(Loc.GetString($"cmd-dumpreagentguidetext-nothing-to-dump"));
             return;
         }
 
@@ -40,7 +39,8 @@ public sealed class DumpReagentGuideText : IConsoleCommand
         {
             foreach (var effect in entry.Effects)
             {
-                shell.WriteLine(effect.GuidebookEffectDescription(_prototype, _entSys) ?? $"[skipped effect of type {effect.GetType()}]");
+                shell.WriteLine(effect.GuidebookEffectDescription(_prototype, EntityManager.EntitySysManager) ??
+                                Loc.GetString($"cmd-dumpreagentguidetext-skipped", ("effect", effect.GetType())));
             }
         }
     }
diff --git a/Resources/Locale/en-US/commands/dump-reagent-guide-text-command.ftl b/Resources/Locale/en-US/commands/dump-reagent-guide-text-command.ftl
new file mode 100644 (file)
index 0000000..694854c
--- /dev/null
@@ -0,0 +1,4 @@
+cmd-dumpreagentguidetext-desc = Dumps the guidebook text for a reagent to the console.
+cmd-dumpreagentguidetext-help = Usage: dumpreagentguidetext <reagentPrototype>
+cmd-dumpreagentguidetext-nothing-to-dump = Nothing to dump.
+cmd-dumpreagentguidetext-skipped = [skipped effect of type {$effect}]