ReadyAll.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Content.Server.GameTicking;
  2. using Content.Shared.Administration;
  3. using Content.Shared.GameTicking;
  4. using Robust.Shared.Console;
  5. namespace Content.Server.Administration.Commands
  6. {
  7. [AdminCommand(AdminFlags.Round)]
  8. public sealed class ReadyAll : IConsoleCommand
  9. {
  10. [Dependency] private readonly IEntityManager _e = default!;
  11. public string Command => "readyall";
  12. public string Description => "Readies up all players in the lobby, except for observers.";
  13. public string Help => $"{Command} | ̣{Command} <ready>";
  14. public void Execute(IConsoleShell shell, string argStr, string[] args)
  15. {
  16. var ready = true;
  17. if (args.Length > 0)
  18. {
  19. ready = bool.Parse(args[0]);
  20. }
  21. var gameTicker = _e.System<GameTicker>();
  22. if (gameTicker.RunLevel != GameRunLevel.PreRoundLobby)
  23. {
  24. shell.WriteLine("This command can only be ran while in the lobby!");
  25. return;
  26. }
  27. gameTicker.ToggleReadyAll(ready);
  28. }
  29. }
  30. }