1
0

RestartRoundCommand.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using Content.Server.Administration;
  2. using Content.Server.RoundEnd;
  3. using Content.Shared.Administration;
  4. using Robust.Shared.Console;
  5. namespace Content.Server.GameTicking.Commands
  6. {
  7. [AdminCommand(AdminFlags.Round)]
  8. public sealed class RestartRoundCommand : IConsoleCommand
  9. {
  10. [Dependency] private readonly IEntityManager _e = default!;
  11. public string Command => "restartround";
  12. public string Description => "Ends the current round and starts the countdown for the next lobby.";
  13. public string Help => string.Empty;
  14. public void Execute(IConsoleShell shell, string argStr, string[] args)
  15. {
  16. var ticker = _e.System<GameTicker>();
  17. if (ticker.RunLevel != GameRunLevel.InRound)
  18. {
  19. shell.WriteLine("This can only be executed while the game is in a round - try restartroundnow");
  20. return;
  21. }
  22. _e.System<RoundEndSystem>().EndRound();
  23. }
  24. }
  25. [AdminCommand(AdminFlags.Round)]
  26. public sealed class RestartRoundNowCommand : IConsoleCommand
  27. {
  28. [Dependency] private readonly IEntityManager _e = default!;
  29. public string Command => "restartroundnow";
  30. public string Description => "Moves the server from PostRound to a new PreRoundLobby.";
  31. public string Help => String.Empty;
  32. public void Execute(IConsoleShell shell, string argStr, string[] args)
  33. {
  34. _e.System<GameTicker>().RestartRound();
  35. }
  36. }
  37. }