ShowGhostsCommand.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Content.Server.Ghost;
  2. using Content.Server.Revenant.EntitySystems;
  3. using Content.Shared.Administration;
  4. using Robust.Shared.Console;
  5. namespace Content.Server.Administration.Commands
  6. {
  7. [AdminCommand(AdminFlags.Admin)]
  8. public sealed class ShowGhostsCommand : IConsoleCommand
  9. {
  10. [Dependency] private readonly IEntityManager _entities = default!;
  11. public string Command => "showghosts";
  12. public string Description => "makes all of the currently present ghosts visible. Cannot be reversed.";
  13. public string Help => "showghosts <visible>";
  14. public void Execute(IConsoleShell shell, string argStr, string[] args)
  15. {
  16. if (args.Length != 1)
  17. {
  18. shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));
  19. return;
  20. }
  21. if (!bool.TryParse(args[0], out var visible))
  22. {
  23. shell.WriteError(Loc.GetString("shell-invalid-bool"));
  24. return;
  25. }
  26. var ghostSys = _entities.EntitySysManager.GetEntitySystem<GhostSystem>();
  27. var revSys = _entities.EntitySysManager.GetEntitySystem<RevenantSystem>();
  28. ghostSys.MakeVisible(visible);
  29. revSys.MakeVisible(visible);
  30. }
  31. }
  32. }