From d703dc8dccdcf82e768ec6f05e42ba974b41027c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Aguilera=20Puerto?= Date: Thu, 20 Aug 2020 15:19:36 +0200 Subject: [PATCH] Adds readyall (b)admin command. --- Content.Server/Administration/ReadyAll.cs | 39 +++++++++++++++++++++++ Resources/Groups/groups.yml | 2 ++ 2 files changed, 41 insertions(+) create mode 100644 Content.Server/Administration/ReadyAll.cs diff --git a/Content.Server/Administration/ReadyAll.cs b/Content.Server/Administration/ReadyAll.cs new file mode 100644 index 0000000000..a03a5b447e --- /dev/null +++ b/Content.Server/Administration/ReadyAll.cs @@ -0,0 +1,39 @@ +using Content.Server.GameTicking; +using Content.Server.Interfaces.GameTicking; +using Robust.Server.Interfaces.Console; +using Robust.Server.Interfaces.Player; +using Robust.Shared.IoC; + +namespace Content.Server.Administration +{ + public class ReadyAll : IClientCommand + { + public string Command => "readyall"; + public string Description => "Readies up all players in the lobby."; + public string Help => $"{Command} | ̣{Command} "; + public void Execute(IConsoleShell shell, IPlayerSession? player, string[] args) + { + var ready = true; + + if (args.Length > 0) + { + ready = bool.Parse(args[0]); + } + + var gameTicker = IoCManager.Resolve(); + var playerManager = IoCManager.Resolve(); + + + if (gameTicker.RunLevel != GameRunLevel.PreRoundLobby) + { + shell.SendText(player, "This command can only be ran while in the lobby!"); + return; + } + + foreach (var p in playerManager.GetAllPlayers()) + { + gameTicker.ToggleReady(p, ready); + } + } + } +} diff --git a/Resources/Groups/groups.yml b/Resources/Groups/groups.yml index ea45d9a588..e18adbfd95 100644 --- a/Resources/Groups/groups.yml +++ b/Resources/Groups/groups.yml @@ -96,6 +96,7 @@ - tilewalls - events - destroymechanism + - readyall CanViewVar: true CanAdminPlace: true @@ -186,6 +187,7 @@ - tilewalls - events - destroymechanism + - readyall CanViewVar: true CanAdminPlace: true CanScript: true