Right click lobby spawns to disable or remove players.

This commit is contained in:
Trevor Nichols
2020-07-19 11:11:27 +10:00
committed by abcdefg30
parent 13581c030d
commit d66e0bb22e
30 changed files with 165 additions and 45 deletions

View File

@@ -60,6 +60,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
MapPreview map;
bool addBotOnMapLoad;
bool disableTeamChat;
bool insufficientPlayerSpawns;
bool teamChat;
bool updateDiscordStatus = true;
Dictionary<int, SpawnOccupant> spawnOccupants = new Dictionary<int, SpawnOccupant>();
@@ -136,6 +137,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
LobbyUtils.SelectSpawnPoint(orderManager, preview, mapPreview, mi))
},
{ "getSpawnOccupants", (Func<Dictionary<int, SpawnOccupant>>)(() => spawnOccupants) },
{ "getDisabledSpawnPoints", (Func<List<int>>)(() => orderManager.LobbyInfo.DisabledSpawnPoints) },
{ "showUnoccupiedSpawnpoints", true },
});
@@ -367,7 +369,8 @@ 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.GlobalSettings.EnableSingleplayer && orderManager.LobbyInfo.NonBotPlayers.Count() < 2);
(!orderManager.LobbyInfo.GlobalSettings.EnableSingleplayer && orderManager.LobbyInfo.NonBotPlayers.Count() < 2) ||
insufficientPlayerSpawns;
startGameButton.OnClick = () =>
{
@@ -570,6 +573,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
c.Bot == null &&
c.Team == orderManager.LocalClient.Team);
var availableSpawnPointCount = map.SpawnPoints.Length - orderManager.LobbyInfo.DisabledSpawnPoints.Count;
insufficientPlayerSpawns = availableSpawnPointCount < orderManager.LobbyInfo.Clients.Count(c => !c.IsObserver);
if (disableTeamChat)
teamChat = false;