CatStation/Content.Server/GameTicking/Commands/ToggleReadyCommand.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

41 lines
1.1 KiB
C#

using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.GameTicking.Commands;
[AnyCommand]
public sealed partial class ToggleReadyCommand : LocalizedEntityCommands
{
[Dependency] private GameTicker _gameTicker = default!;
public override string Command => "toggleready";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
shell.WriteError(Loc.GetString("shell-need-exactly-one-argument"));
return;
}
if (shell.Player is not { } player)
{
shell.WriteError(Loc.GetString("shell-only-players-can-run-this-command"));
return;
}
if (_gameTicker.RunLevel != GameRunLevel.PreRoundLobby)
{
shell.WriteError(Loc.GetString("shell-can-only-run-from-pre-round-lobby"));
return;
}
if (!bool.TryParse(args[0], out var ready))
{
shell.WriteError(Loc.GetString("shell-argument-must-be-boolean"));
return;
}
_gameTicker.ToggleReady(player, ready);
}
}