Files
tbd-station-14/Content.Server/GameTicking/Commands/RestartRoundCommand.cs
2025-09-03 12:49:34 +02:00

40 lines
1.1 KiB
C#

using Content.Server.Administration;
using Content.Server.RoundEnd;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.GameTicking.Commands;
[AdminCommand(AdminFlags.Round)]
public sealed class RestartRoundCommand : LocalizedEntityCommands
{
[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)
{
if (_gameTicker.RunLevel != GameRunLevel.InRound)
{
shell.WriteLine(Loc.GetString("shell-can-only-run-while-round-is-active"));
return;
}
_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();
}
}