mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-06-09 10:06:46 +02:00
negative round start delays (#38270)
* remove u from the game * Loc strings * by * meow * delaystart my beloved * optional * i dont webedit --------- Co-authored-by: beck-thompson <beck314159@hotmail.com> Co-authored-by: ScarKy0 <scarky0@onet.eu> Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
This commit is contained in:
@@ -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<GameTicker>();
|
||||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user