From 61635233343a00c8b483f7aec5abb5c05cc6476f Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sun, 14 Apr 2019 14:38:00 +0200 Subject: [PATCH] Enable spectator team chat in the lobby --- OpenRA.Game/Network/UnitOrders.cs | 3 ++- OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/OpenRA.Game/Network/UnitOrders.cs b/OpenRA.Game/Network/UnitOrders.cs index c17fc16fec..7de00d3dbb 100644 --- a/OpenRA.Game/Network/UnitOrders.cs +++ b/OpenRA.Game/Network/UnitOrders.cs @@ -80,8 +80,9 @@ namespace OpenRA.Network // We are still in the lobby if (world == null) { + var prefix = order.ExtraData == uint.MaxValue ? "[Spectators] " : "[Team] "; if (orderManager.LocalClient != null && client.Team == orderManager.LocalClient.Team) - Game.AddChatLine(client.Color, "[Team] " + client.Name, message); + Game.AddChatLine(client.Color, prefix + client.Name, message); break; } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 958844436e..9abcd2fc53 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -550,8 +550,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (orderManager.LocalClient == null) return; - disableTeamChat = orderManager.LocalClient.Team == 0 || - !orderManager.LobbyInfo.Clients.Any(c => + // Check if we are not assigned to any team, and are no spectator + // If we are a spectator, check if there are more and enable spectator chat + // Otherwise check if our assigned team has more players + if (orderManager.LocalClient.Team == 0 && !orderManager.LocalClient.IsObserver) + disableTeamChat = true; + else if (orderManager.LocalClient.IsObserver) + disableTeamChat = !orderManager.LobbyInfo.Clients.Any(c => c != orderManager.LocalClient && c.IsObserver); + else + disableTeamChat = !orderManager.LobbyInfo.Clients.Any(c => c != orderManager.LocalClient && c.Bot == null && c.Team == orderManager.LocalClient.Team);