]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Crew manifest command cleanup and LEC (#38544)
authorKyle Tyo <36606155+VerinSenpai@users.noreply.github.com>
Tue, 24 Jun 2025 11:06:20 +0000 (07:06 -0400)
committerGitHub <noreply@github.com>
Tue, 24 Jun 2025 11:06:20 +0000 (13:06 +0200)
commit

Content.Server/CrewManifest/CrewManifestSystem.cs
Resources/Locale/en-US/commands/crew-manifest-command.ftl [new file with mode: 0644]

index e7424560159e2047be5ed0b6470e3c2256992c4c..d8e0858ce019eb671b3890f3d0ea83393d12afe0 100644 (file)
@@ -251,56 +251,45 @@ public sealed class CrewManifestSystem : EntitySystem
 }
 
 [AdminCommand(AdminFlags.Admin)]
-public sealed class CrewManifestCommand : IConsoleCommand
+public sealed class CrewManifestCommand : LocalizedEntityCommands
 {
-    public string Command => "crewmanifest";
-    public string Description => "Opens the crew manifest for the given station.";
-    public string Help => $"Usage: {Command} <entity uid>";
+    [Dependency] private readonly CrewManifestSystem _manifestSystem = default!;
 
-    [Dependency] private readonly IEntityManager _entityManager = default!;
+    public override string Command => "crewmanifest";
 
-    public CrewManifestCommand()
-    {
-        IoCManager.InjectDependencies(this);
-    }
-
-    public void Execute(IConsoleShell shell, string argStr, string[] args)
+    public override void Execute(IConsoleShell shell, string argStr, string[] args)
     {
         if (args.Length != 1)
         {
-            shell.WriteLine($"Invalid argument count.\n{Help}");
+            shell.WriteLine(Loc.GetString($"shell-need-exactly-one-argument"));
             return;
         }
 
-        if (!NetEntity.TryParse(args[0], out var uidNet) || !_entityManager.TryGetEntity(uidNet, out var uid))
+        if (!NetEntity.TryParse(args[0], out var uidNet) || !EntityManager.TryGetEntity(uidNet, out var uid))
         {
-            shell.WriteLine($"{args[0]} is not a valid entity UID.");
+            shell.WriteLine(Loc.GetString($"shell-argument-station-id-invalid", ("index", args[0])));
             return;
         }
 
-        if (shell.Player == null || shell.Player is not { } session)
+        if (shell.Player is not { } session)
         {
-            shell.WriteLine("You must run this from a client.");
+            shell.WriteLine(Loc.GetString($"shell-cannot-run-command-from-server"));
             return;
         }
 
-        var crewManifestSystem = _entityManager.System<CrewManifestSystem>();
-
-        crewManifestSystem.OpenEui(uid.Value, session);
+        _manifestSystem.OpenEui(uid.Value, session);
     }
 
-    public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
+    public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
     {
         if (args.Length != 1)
-        {
             return CompletionResult.Empty;
-        }
 
         var stations = new List<CompletionOption>();
-        var query = _entityManager.EntityQueryEnumerator<StationDataComponent>();
+        var query = EntityManager.EntityQueryEnumerator<StationDataComponent>();
         while (query.MoveNext(out var uid, out _))
         {
-            var meta = _entityManager.GetComponent<MetaDataComponent>(uid);
+            var meta = EntityManager.GetComponent<MetaDataComponent>(uid);
             stations.Add(new CompletionOption(uid.ToString(), meta.EntityName));
         }
 
diff --git a/Resources/Locale/en-US/commands/crew-manifest-command.ftl b/Resources/Locale/en-US/commands/crew-manifest-command.ftl
new file mode 100644 (file)
index 0000000..8b46e3e
--- /dev/null
@@ -0,0 +1,2 @@
+cmd-crewmanifest-desc = Opens the crew manifest for the given station.
+cmd-crewmanifest-help = Usage: crewmanifest <entityUid>