]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Revise ShowAccessReadersCommand as LocalizedEntityCommands (#37991)
authorKyle Tyo <36606155+VerinSenpai@users.noreply.github.com>
Thu, 5 Jun 2025 23:17:31 +0000 (19:17 -0400)
committerGitHub <noreply@github.com>
Thu, 5 Jun 2025 23:17:31 +0000 (19:17 -0400)
* revise ShowAccessReadersCommand

* don't believe this is needed anymore? hopefully servers world wide don't explode.

Content.Client/Access/Commands/ShowAccessReadersCommand.cs
Resources/Locale/en-US/commands/show-access-readers-command.ftl [new file with mode: 0644]

index cb6cb6cf6bb0148e2176261071e78c12401a27c9..e26cca0fc26290c4597edd2782f7fb6c1efb0145 100644 (file)
@@ -4,39 +4,20 @@ using Robust.Shared.Console;
 
 namespace Content.Client.Access.Commands;
 
-public sealed class ShowAccessReadersCommand : IConsoleCommand
+public sealed class ShowAccessReadersCommand : LocalizedEntityCommands
 {
-    public string Command => "showaccessreaders";
+    [Dependency] private readonly IOverlayManager _overlay = default!;
+    [Dependency] private readonly IResourceCache _cache = default!;
+    [Dependency] private readonly SharedTransformSystem _xform = default!;
 
-    public string Description => "Toggles showing access reader permissions on the map";
-    public string Help => """
-        Overlay Info:
-        -Disabled | The access reader is disabled
-        +Unrestricted | The access reader has no restrictions
-        +Set [Index]: [Tag Name]| A tag in an access set (accessor needs all tags in the set to be allowed by the set)
-        +Key [StationUid]: [StationRecordKeyId] | A StationRecordKey that is allowed
-        -Tag [Tag Name] | A tag that is not allowed (takes priority over other allows)
-        """;
-    public void Execute(IConsoleShell shell, string argStr, string[] args)
-    {
-        var collection = IoCManager.Instance;
-
-        if (collection == null)
-            return;
-
-        var overlay = collection.Resolve<IOverlayManager>();
+    public override string Command => "showaccessreaders";
 
-        if (overlay.RemoveOverlay<AccessOverlay>())
-        {
-            shell.WriteLine($"Set access reader debug overlay to false");
-            return;
-        }
-
-        var entManager = collection.Resolve<IEntityManager>();
-        var cache = collection.Resolve<IResourceCache>();
-        var xform = entManager.System<SharedTransformSystem>();
+    public override void Execute(IConsoleShell shell, string argStr, string[] args)
+    {
+        var existing = _overlay.RemoveOverlay<AccessOverlay>();
+        if (!existing)
+            _overlay.AddOverlay(new AccessOverlay(EntityManager, _cache, _xform));
 
-        overlay.AddOverlay(new AccessOverlay(entManager, cache, xform));
-        shell.WriteLine($"Set access reader debug overlay to true");
+        shell.WriteLine(Loc.GetString($"cmd-showaccessreaders-status", ("status", !existing)));
     }
 }
diff --git a/Resources/Locale/en-US/commands/show-access-readers-command.ftl b/Resources/Locale/en-US/commands/show-access-readers-command.ftl
new file mode 100644 (file)
index 0000000..f74553a
--- /dev/null
@@ -0,0 +1,9 @@
+cmd-showaccessreaders-desc = Toggles showing access reader permissions on the map
+cmd-showaccessreaders-help =
+    Overlay Info:
+    -Disabled | The access reader is disabled
+    +Unrestricted | The access reader has no restrictions
+    +Set [Index]: [Tag Name]| A tag in an access set (accessor needs all tags in the set to be allowed by the set)
+    +Key [StationUid]: [StationRecordKeyId] | A StationRecordKey that is allowed
+    -Tag [Tag Name] | A tag that is not allowed (takes priority over other allows)
+cmd-showaccessreaders-status = Set access reader debug overlay to {$status}.