Localize, cleanup, and LEC round control commands. (#38812)

* commit-progress

* commit
This commit is contained in:
Kyle Tyo
2025-09-03 06:49:34 -04:00
committed by GitHub
parent d3731395b6
commit 0e884da5eb
9 changed files with 108 additions and 112 deletions

View File

@@ -3,43 +3,37 @@ using Content.Server.RoundEnd;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.GameTicking.Commands
namespace Content.Server.GameTicking.Commands;
[AdminCommand(AdminFlags.Round)]
public sealed class RestartRoundCommand : LocalizedEntityCommands
{
[AdminCommand(AdminFlags.Round)]
public sealed class RestartRoundCommand : IConsoleCommand
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly RoundEndSystem _roundEndSystem = default!;
public override string Command => "restartround";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "restartround";
public string Description => "Ends the current round and starts the countdown for the next lobby.";
public string Help => string.Empty;
public void Execute(IConsoleShell shell, string argStr, string[] args)
if (_gameTicker.RunLevel != GameRunLevel.InRound)
{
var ticker = _e.System<GameTicker>();
if (ticker.RunLevel != GameRunLevel.InRound)
{
shell.WriteLine("This can only be executed while the game is in a round - try restartroundnow");
return;
}
_e.System<RoundEndSystem>().EndRound();
shell.WriteLine(Loc.GetString("shell-can-only-run-while-round-is-active"));
return;
}
}
[AdminCommand(AdminFlags.Round)]
public sealed class RestartRoundNowCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "restartroundnow";
public string Description => "Moves the server from PostRound to a new PreRoundLobby.";
public string Help => String.Empty;
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
_e.System<GameTicker>().RestartRound();
}
_roundEndSystem.EndRound();
}
}
[AdminCommand(AdminFlags.Round)]
public sealed class RestartRoundNowCommand : LocalizedEntityCommands
{
[Dependency] private readonly GameTicker _gameTicker = default!;
public override string Command => "restartroundnow";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
_gameTicker.RestartRound();
}
}