From db38a9c945c0ff9810df9061d71a63176914f8e5 Mon Sep 17 00:00:00 2001 From: Kyle Tyo <36606155+VerinSenpai@users.noreply.github.com> Date: Thu, 5 Jun 2025 19:17:31 -0400 Subject: [PATCH] Revise ShowAccessReadersCommand as LocalizedEntityCommands (#37991) * revise ShowAccessReadersCommand * don't believe this is needed anymore? hopefully servers world wide don't explode. --- .../Commands/ShowAccessReadersCommand.cs | 41 +++++-------------- .../commands/show-access-readers-command.ftl | 9 ++++ 2 files changed, 20 insertions(+), 30 deletions(-) create mode 100644 Resources/Locale/en-US/commands/show-access-readers-command.ftl diff --git a/Content.Client/Access/Commands/ShowAccessReadersCommand.cs b/Content.Client/Access/Commands/ShowAccessReadersCommand.cs index cb6cb6cf6b..e26cca0fc2 100644 --- a/Content.Client/Access/Commands/ShowAccessReadersCommand.cs +++ b/Content.Client/Access/Commands/ShowAccessReadersCommand.cs @@ -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) + public override string Command => "showaccessreaders"; + + public override void Execute(IConsoleShell shell, string argStr, string[] args) { - var collection = IoCManager.Instance; + var existing = _overlay.RemoveOverlay(); + if (!existing) + _overlay.AddOverlay(new AccessOverlay(EntityManager, _cache, _xform)); - if (collection == null) - return; - - var overlay = collection.Resolve(); - - if (overlay.RemoveOverlay()) - { - shell.WriteLine($"Set access reader debug overlay to false"); - return; - } - - var entManager = collection.Resolve(); - var cache = collection.Resolve(); - var xform = entManager.System(); - - 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 index 0000000000..f74553a066 --- /dev/null +++ b/Resources/Locale/en-US/commands/show-access-readers-command.ftl @@ -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}.