Enable spectator team chat in the lobby

This commit is contained in:
abcdefg30
2019-04-14 14:38:00 +02:00
committed by Paul Chote
parent e6feba8884
commit 6163523334
2 changed files with 11 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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);