Files
crystall-punk-14/Content.Server/Administration/Commands/ReadyAll.cs

43 lines
1.3 KiB
C#
Raw Normal View History

using Content.Server.GameTicking;
using Content.Shared.Administration;
using Content.Shared.GameTicking;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;
2020-08-20 15:19:36 +02:00
using Robust.Shared.IoC;
namespace Content.Server.Administration.Commands
2020-08-20 15:19:36 +02:00
{
[AdminCommand(AdminFlags.Round)]
public sealed class ReadyAll : IConsoleCommand
2020-08-20 15:19:36 +02:00
{
public string Command => "readyall";
public string Description => "Readies up all players in the lobby, except for observers.";
2020-08-20 15:19:36 +02:00
public string Help => $"{Command} | ̣{Command} <ready>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
2020-08-20 15:19:36 +02:00
{
var ready = true;
if (args.Length > 0)
{
ready = bool.Parse(args[0]);
}
var gameTicker = EntitySystem.Get<GameTicker>();
2020-08-20 15:19:36 +02:00
if (gameTicker.RunLevel != GameRunLevel.PreRoundLobby)
{
shell.WriteLine("This command can only be ran while in the lobby!");
2020-08-20 15:19:36 +02:00
return;
}
foreach (var (player, status) in gameTicker.PlayersInLobby)
2020-08-20 15:19:36 +02:00
{
if(status != LobbyPlayerStatus.Observer)
gameTicker.ToggleReady(player, ready);
2020-08-20 15:19:36 +02:00
}
}
}
}