1
0

NodeVisCommand.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Content.Client.Administration.Managers;
  2. using Content.Shared.Administration;
  3. using Robust.Shared.Console;
  4. using Robust.Shared.GameObjects;
  5. using Robust.Shared.IoC;
  6. namespace Content.Client.NodeContainer
  7. {
  8. public sealed class NodeVisCommand : IConsoleCommand
  9. {
  10. [Dependency] private readonly IEntityManager _e = default!;
  11. public string Command => "nodevis";
  12. public string Description => "Toggles node group visualization";
  13. public string Help => "";
  14. public void Execute(IConsoleShell shell, string argStr, string[] args)
  15. {
  16. var adminMan = IoCManager.Resolve<IClientAdminManager>();
  17. if (!adminMan.HasFlag(AdminFlags.Debug))
  18. {
  19. shell.WriteError("You need +DEBUG for this command");
  20. return;
  21. }
  22. var sys = _e.System<NodeGroupSystem>();
  23. sys.SetVisEnabled(!sys.VisEnabled);
  24. }
  25. }
  26. public sealed class NodeVisFilterCommand : IConsoleCommand
  27. {
  28. [Dependency] private readonly IEntityManager _e = default!;
  29. public string Command => "nodevisfilter";
  30. public string Description => "Toggles showing a specific group on nodevis";
  31. public string Help => "Usage: nodevis [filter]\nOmit filter to list currently masked-off";
  32. public void Execute(IConsoleShell shell, string argStr, string[] args)
  33. {
  34. var sys = _e.System<NodeGroupSystem>();
  35. if (args.Length == 0)
  36. {
  37. foreach (var filtered in sys.Filtered)
  38. {
  39. shell.WriteLine(filtered);
  40. }
  41. }
  42. else
  43. {
  44. var filter = args[0];
  45. if (!sys.Filtered.Add(filter))
  46. {
  47. sys.Filtered.Remove(filter);
  48. }
  49. }
  50. }
  51. }
  52. }