diff --git a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs index 790c3c3846..565caaa2b5 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs @@ -60,7 +60,8 @@ namespace OpenRA.Mods.Common.Server static void CheckAutoStart(S server) { - var playerClients = server.LobbyInfo.Clients.Where(c => c.Bot == null && c.Slot != null); + // A spectating admin is included for checking these rules + var playerClients = server.LobbyInfo.Clients.Where(c => (c.Bot == null && c.Slot != null) || c.IsAdmin); // Are all players ready? if (!playerClients.Any() || playerClients.Any(c => c.State != Session.ClientState.Ready)) @@ -188,6 +189,7 @@ namespace OpenRA.Mods.Common.Server client.SpawnPoint = 0; client.Color = HSLColor.FromRGB(255, 255, 255); server.SyncLobbyClients(); + CheckAutoStart(server); return true; } else diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index d243e206b0..9433921c20 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -708,7 +708,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic LobbyUtils.SetupEditableFactionWidget(template, slot, client, orderManager, factions); LobbyUtils.SetupEditableTeamWidget(template, slot, client, orderManager, Map); LobbyUtils.SetupEditableSpawnWidget(template, slot, client, orderManager, Map); - LobbyUtils.SetupEditableReadyWidget(template, slot, client, orderManager, Map, !Map.RulesLoaded || Map.InvalidCustomRules); + LobbyUtils.SetupEditableReadyWidget(template, slot, client, orderManager, Map); } else { @@ -754,6 +754,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic template = editableSpectatorTemplate.Clone(); LobbyUtils.SetupEditableNameWidget(template, null, c, orderManager); + + if (client.IsAdmin) + LobbyUtils.SetupEditableReadyWidget(template, null, client, orderManager, Map); } else { @@ -763,7 +766,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic LobbyUtils.SetupNameWidget(template, null, client); LobbyUtils.SetupKickWidget(template, null, client, orderManager, lobby, - () => panel = PanelType.Kick, () => panel = PanelType.Players); + () => panel = PanelType.Kick, () => panel = PanelType.Players); + + if (client.IsAdmin) + LobbyUtils.SetupReadyWidget(template, null, client); } LobbyUtils.SetupClientWidget(template, c, orderManager, true); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index 6a06617a77..2d35e0a4cb 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -457,12 +457,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic parent.Get("SPAWN").GetText = () => (c.SpawnPoint == 0) ? "-" : Convert.ToChar('A' - 1 + c.SpawnPoint).ToString(); } - public static void SetupEditableReadyWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, MapPreview map, bool forceDisable) + public static void SetupEditableReadyWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, MapPreview map) { var status = parent.Get("STATUS_CHECKBOX"); status.IsChecked = () => orderManager.LocalClient.IsReady || c.Bot != null; status.IsVisible = () => true; - status.IsDisabled = () => c.Bot != null || map.Status != MapStatus.Available || forceDisable; + status.IsDisabled = () => c.Bot != null || map.Status != MapStatus.Available || + !map.RulesLoaded || map.InvalidCustomRules; var state = orderManager.LocalClient.IsReady ? Session.ClientState.NotReady : Session.ClientState.Ready; status.OnClick = () => orderManager.IssueOrder(Order.Command("state {0}".F(state))); diff --git a/mods/cnc/chrome/lobby-players.yaml b/mods/cnc/chrome/lobby-players.yaml index 61484ddffd..1d992f3431 100644 --- a/mods/cnc/chrome/lobby-players.yaml +++ b/mods/cnc/chrome/lobby-players.yaml @@ -300,6 +300,20 @@ Container@LOBBY_PLAYER_BIN: Text: Spectator Align: Center Font: Bold + Image@STATUS_IMAGE: + X: 521 + Y: 4 + Width: 20 + Height: 20 + ImageCollection: checkbox-bits + ImageName: checked + Visible: false + Checkbox@STATUS_CHECKBOX: + X: 527 + Y: 2 + Width: 20 + Height: 20 + Visible: false Container@TEMPLATE_NONEDITABLE_SPECTATOR: X: 5 Width: 530 @@ -350,6 +364,14 @@ Container@LOBBY_PLAYER_BIN: Text: Spectator Align: Center Font: Bold + Image@STATUS_IMAGE: + X: 527 + Y: 4 + Width: 20 + Height: 20 + ImageCollection: checkbox-bits + ImageName: checked + Visible: false Container@TEMPLATE_NEW_SPECTATOR: X: 5 Width: 529 diff --git a/mods/d2k/chrome/lobby-players.yaml b/mods/d2k/chrome/lobby-players.yaml index 1f69393c18..6edfdf4772 100644 --- a/mods/d2k/chrome/lobby-players.yaml +++ b/mods/d2k/chrome/lobby-players.yaml @@ -291,6 +291,20 @@ Container@LOBBY_PLAYER_BIN: Text: Spectator Align: Center Font: Bold + Checkbox@STATUS_CHECKBOX: + X: 525 + Y: 2 + Width: 20 + Height: 20 + Visible: false + Image@STATUS_IMAGE: + X: 527 + Y: 4 + Width: 20 + Height: 20 + ImageCollection: checkbox-bits + ImageName: checked + Visible: false Container@TEMPLATE_NONEDITABLE_SPECTATOR: X: 5 Width: 475 @@ -338,6 +352,14 @@ Container@LOBBY_PLAYER_BIN: Text: Spectator Align: Center Font: Bold + Image@STATUS_IMAGE: + X: 527 + Y: 4 + Width: 20 + Height: 20 + ImageCollection: checkbox-bits + ImageName: checked + Visible: false Container@TEMPLATE_NEW_SPECTATOR: X: 5 Width: 475 diff --git a/mods/ra/chrome/lobby-players.yaml b/mods/ra/chrome/lobby-players.yaml index 3b03e70562..8289b60019 100644 --- a/mods/ra/chrome/lobby-players.yaml +++ b/mods/ra/chrome/lobby-players.yaml @@ -291,6 +291,20 @@ Container@LOBBY_PLAYER_BIN: Text: Spectator Align: Center Font: Bold + Checkbox@STATUS_CHECKBOX: + X: 525 + Y: 2 + Width: 20 + Height: 20 + Visible: false + Image@STATUS_IMAGE: + X: 527 + Y: 4 + Width: 20 + Height: 20 + ImageCollection: checkbox-bits + ImageName: checked + Visible: false Container@TEMPLATE_NONEDITABLE_SPECTATOR: X: 5 Width: 475 @@ -338,6 +352,14 @@ Container@LOBBY_PLAYER_BIN: Text: Spectator Align: Center Font: Bold + Image@STATUS_IMAGE: + X: 527 + Y: 4 + Width: 20 + Height: 20 + ImageCollection: checkbox-bits + ImageName: checked + Visible: false Container@TEMPLATE_NEW_SPECTATOR: X: 5 Width: 475