ShowAccessReadersCommand.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Robust.Client.Graphics;
  2. using Robust.Client.ResourceManagement;
  3. using Robust.Shared.Console;
  4. namespace Content.Client.Access.Commands;
  5. public sealed class ShowAccessReadersCommand : IConsoleCommand
  6. {
  7. public string Command => "showaccessreaders";
  8. public string Description => "Toggles showing access reader permissions on the map";
  9. public string Help => """
  10. Overlay Info:
  11. -Disabled | The access reader is disabled
  12. +Unrestricted | The access reader has no restrictions
  13. +Set [Index]: [Tag Name]| A tag in an access set (accessor needs all tags in the set to be allowed by the set)
  14. +Key [StationUid]: [StationRecordKeyId] | A StationRecordKey that is allowed
  15. -Tag [Tag Name] | A tag that is not allowed (takes priority over other allows)
  16. """;
  17. public void Execute(IConsoleShell shell, string argStr, string[] args)
  18. {
  19. var collection = IoCManager.Instance;
  20. if (collection == null)
  21. return;
  22. var overlay = collection.Resolve<IOverlayManager>();
  23. if (overlay.RemoveOverlay<AccessOverlay>())
  24. {
  25. shell.WriteLine($"Set access reader debug overlay to false");
  26. return;
  27. }
  28. var entManager = collection.Resolve<IEntityManager>();
  29. var cache = collection.Resolve<IResourceCache>();
  30. var xform = entManager.System<SharedTransformSystem>();
  31. overlay.AddOverlay(new AccessOverlay(entManager, cache, xform));
  32. shell.WriteLine($"Set access reader debug overlay to true");
  33. }
  34. }