From 33f30383164b888a26440002b93f713a917b84b2 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 15 Apr 2020 14:21:09 +0100 Subject: [PATCH] Fix map-specific factions remaining selected when changing map. --- OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs index 6c779f3513..1f595bb73a 100644 --- a/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.Common/ServerTraits/LobbyCommands.cs @@ -398,8 +398,17 @@ namespace OpenRA.Mods.Common.Server LoadMapSettings(server, server.LobbyInfo.GlobalSettings, server.Map.Rules); // Reset client states + var selectableFactions = server.Map.Rules.Actors["world"].TraitInfos() + .Where(f => f.Selectable) + .Select(f => f.InternalName) + .ToList(); + foreach (var c in server.LobbyInfo.Clients) + { c.State = Session.ClientState.Invalid; + if (!selectableFactions.Contains(c.Faction)) + c.Faction = "Random"; + } // Reassign players into new slots based on their old slots: // - Observers remain as observers