diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs index 1cb8910d6c..c15389cb19 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs @@ -507,7 +507,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic factionflag.GetImageCollection = () => "flags"; var team = template.GetWidget("TEAM"); - team.IsDisabled = () => slot.LockTeam || ready || client.Bot != null; + team.IsDisabled = () => slot.LockTeam || ready; team.OnMouseDown = _ => team.IsDisabled() ? true : ShowTeamDropDown(team, client); team.GetText = () => (client.Team == 0) ? "-" : client.Team.ToString(); diff --git a/OpenRA.Mods.RA/HackyAI.cs b/OpenRA.Mods.RA/HackyAI.cs index c4a38c0c04..c0486602c2 100644 --- a/OpenRA.Mods.RA/HackyAI.cs +++ b/OpenRA.Mods.RA/HackyAI.cs @@ -246,24 +246,14 @@ namespace OpenRA.Mods.RA //Units that the ai already knows about. Any unit not on this list needs to be given a role. List activeUnits = new List(); - bool IsHumanPlayer(Player p) { return !p.IsBot && !p.NonCombatant; } - - bool HasHumanPlayers() - { - return p.World.Players.Any(a => !a.IsBot && !a.NonCombatant); - } - int2? ChooseEnemyTarget() { // Criteria for picking an enemy: // 1. not ourself. - // 2. human. + // 2. enemy. // 3. not dead. - - - var possibleTargets = world.WorldActor.Trait().Start - .Where(kv => kv.Key != p && (!HasHumanPlayers() || IsHumanPlayer(kv.Key)) + .Where(kv => kv.Key != p && p.Stances[kv.Key] == Stance.Enemy && p.WinState == WinState.Undefined) .Select(kv => kv.Value); @@ -325,7 +315,7 @@ namespace OpenRA.Mods.RA foreach (var a1 in attackForce) { var enemyUnits = world.FindUnitsInCircle(a1.CenterLocation, Game.CellSize * 10) - .Where(unit => IsHumanPlayer(unit.Owner)).ToList(); + .Where(unit => p.Stances[unit.Owner] == Stance.Enemy).ToList(); if (enemyUnits.Count > 0) {