diff --git a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs index b29fe1432c..6c18147312 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs @@ -33,6 +33,9 @@ namespace OpenRA.Mods.Common.Server [TranslationReference] static readonly string NoStartUntilRequiredSlotsFull = "no-start-until-required-slots-full"; + [TranslationReference] + static readonly string NoStartWithoutPlayers = "no-start-without-players"; + [TranslationReference] static readonly string TwoHumansRequired = "two-humans-required"; @@ -252,6 +255,10 @@ namespace OpenRA.Mods.Common.Server if (server.LobbyInfo.Slots.Any(sl => sl.Value.Required && server.LobbyInfo.ClientInSlot(sl.Key) == null)) return; + // Don't start without any players + if (server.LobbyInfo.Slots.All(sl => server.LobbyInfo.ClientInSlot(sl.Key) == null)) + return; + if (LobbyUtils.InsufficientEnabledSpawnPoints(server.Map, server.LobbyInfo)) return; @@ -296,6 +303,12 @@ namespace OpenRA.Mods.Common.Server return true; } + if (server.LobbyInfo.Slots.All(sl => server.LobbyInfo.ClientInSlot(sl.Key) == null)) + { + server.SendOrderTo(conn, "Message", NoStartWithoutPlayers); + return true; + } + if (!server.LobbyInfo.GlobalSettings.EnableSingleplayer && server.LobbyInfo.NonBotPlayers.Count() < 2) { server.SendLocalizedMessageTo(conn, TwoHumansRequired); diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 63a95e7823..52f7f36730 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -383,6 +383,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { startGameButton.IsDisabled = () => configurationDisabled() || map.Status != MapStatus.Available || orderManager.LobbyInfo.Slots.Any(sl => sl.Value.Required && orderManager.LobbyInfo.ClientInSlot(sl.Key) == null) || + orderManager.LobbyInfo.Slots.All(sl => orderManager.LobbyInfo.ClientInSlot(sl.Key) == null) || (!orderManager.LobbyInfo.GlobalSettings.EnableSingleplayer && orderManager.LobbyInfo.NonBotPlayers.Count() < 2) || insufficientPlayerSpawns; diff --git a/mods/common/languages/en.ftl b/mods/common/languages/en.ftl index 46175d8afc..e65e9aa258 100644 --- a/mods/common/languages/en.ftl +++ b/mods/common/languages/en.ftl @@ -6,6 +6,7 @@ two-humans-required = This server requires at least two human players to start a unknown-server-command = Unknown server command: { $command } only-only-host-start-game = Only the host can start the game. no-start-until-required-slots-full = Unable to start the game until required slots are full. +no-start-without-players = Unable to start the game with no players. insufficient-enabled-spawnPoints = Unable to start the game until more spawn points are enabled. malformed-command = Malformed { $command } command chat-disabled =