From: Kyle Tyo <36606155+VerinSenpai@users.noreply.github.com> Date: Tue, 24 Jun 2025 11:06:20 +0000 (-0400) Subject: Crew manifest command cleanup and LEC (#38544) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=eb359fb760cd9df59d831c988c2fb453cce0be8b;p=space-station-14.git Crew manifest command cleanup and LEC (#38544) commit --- diff --git a/Content.Server/CrewManifest/CrewManifestSystem.cs b/Content.Server/CrewManifest/CrewManifestSystem.cs index e742456015..d8e0858ce0 100644 --- a/Content.Server/CrewManifest/CrewManifestSystem.cs +++ b/Content.Server/CrewManifest/CrewManifestSystem.cs @@ -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} "; + [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.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(); - var query = _entityManager.EntityQueryEnumerator(); + var query = EntityManager.EntityQueryEnumerator(); while (query.MoveNext(out var uid, out _)) { - var meta = _entityManager.GetComponent(uid); + var meta = EntityManager.GetComponent(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 index 0000000000..8b46e3ec6d --- /dev/null +++ b/Resources/Locale/en-US/commands/crew-manifest-command.ftl @@ -0,0 +1,2 @@ +cmd-crewmanifest-desc = Opens the crew manifest for the given station. +cmd-crewmanifest-help = Usage: crewmanifest