diff --git a/Content.Server/GameTicking/Commands/DelayStartCommand.cs b/Content.Server/GameTicking/Commands/DelayStartCommand.cs index dd3ee86fba..d82d2f0f12 100644 --- a/Content.Server/GameTicking/Commands/DelayStartCommand.cs +++ b/Content.Server/GameTicking/Commands/DelayStartCommand.cs @@ -1,45 +1,46 @@ -using Content.Server.Administration; +using Content.Server.Administration; using Content.Shared.Administration; using Robust.Shared.Console; namespace Content.Server.GameTicking.Commands; [AdminCommand(AdminFlags.Round)] -public sealed partial class DelayStartCommand : LocalizedEntityCommands +sealed class DelayStartCommand : LocalizedEntityCommands { - [Dependency] private GameTicker _gameTicker = default!; - public override string Command => "delaystart"; public override void Execute(IConsoleShell shell, string argStr, string[] args) { - if (_gameTicker.RunLevel != GameRunLevel.PreRoundLobby) + var ticker = EntityManager.System(); + if (ticker.RunLevel != GameRunLevel.PreRoundLobby) { - shell.WriteLine(Loc.GetString("shell-can-only-run-from-pre-round-lobby")); + shell.WriteLine(Loc.GetString("delaystart-preround-only")); return; } - switch (args.Length) + if (args.Length == 0) { - case 0: - var paused = _gameTicker.TogglePause(); - shell.WriteLine(Loc.GetString(paused ? "cmd-delaystart-paused" : "cmd-delaystart-unpaused")); - return; - case 1: - break; - default: - shell.WriteError(Loc.GetString("shell-wrong-arguments-number")); - return; + var paused = ticker.TogglePause(); + shell.WriteLine(paused ? Loc.GetString("delaystart-paused") : Loc.GetString("delaystart-resumed")); + return; } - if (!uint.TryParse(args[0], out var seconds) || seconds == 0) + if (args.Length != 1) { - shell.WriteLine(Loc.GetString("cmd-delaystart-invalid-seconds", ("value", args[0]))); + shell.WriteLine(Loc.GetString("shell-need-between-arguments", ("lower", 0), ("upper", 1))); + return; + } + + if (!int.TryParse(args[0], out var seconds) || seconds == 0) + { + shell.WriteLine(Loc.GetString("delaystart-invalid-seconds", ("seconds", args[0]))); return; } var time = TimeSpan.FromSeconds(seconds); - if (!_gameTicker.DelayStart(time)) - shell.WriteLine(Loc.GetString("cmd-delaystart-too-late")); + if (!ticker.DelayStart(time)) + { + shell.WriteLine(Loc.GetString("shell-unknown-error")); + } } } diff --git a/Resources/Locale/en-US/commands/delaystart-command.ftl b/Resources/Locale/en-US/commands/delaystart-command.ftl index e5189a7822..77560508b3 100644 --- a/Resources/Locale/en-US/commands/delaystart-command.ftl +++ b/Resources/Locale/en-US/commands/delaystart-command.ftl @@ -1,7 +1,7 @@ -cmd-delaystart-desc = Delays the round start. +cmd-delaystart-desc = Adjusts the roundstart timer (accepts positive and negative integers). Pauses/Resumes the countdown if no argument is provided. cmd-delaystart-help = Usage: delaystart [seconds] - If no arguments are passed, the round will be paused or resumed accordingly. -cmd-delaystart-invalid-seconds = {$value} isn't a valid amount of seconds. -cmd-delaystart-paused = Paused the countdown. -cmd-delaystart-unpaused = Resumed the countdown. -cmd-delaystart-too-late = Round start could not be delayed in time! + +delaystart-preround-only = This can only be executed while the game is in the pre-round lobby. +delaystart-paused = Paused the countdown. +delaystart-resumed = Resumed the countdown. +delaystart-invalid-seconds = {$seconds} isn't a valid amount of seconds. diff --git a/Resources/Locale/en-US/shell.ftl b/Resources/Locale/en-US/shell.ftl index 36bebeae35..99ef9ca2cc 100644 --- a/Resources/Locale/en-US/shell.ftl +++ b/Resources/Locale/en-US/shell.ftl @@ -12,6 +12,8 @@ shell-only-players-can-run-this-command = Only players can run this command. shell-must-be-attached-to-entity = You must be attached to an entity to run this command. shell-must-have-body = You must have a body to run this command. +shell-unknown-error = An unknown error has occured. + ## Arguments shell-need-exactly-one-argument = Need exactly one argument.