From 4da2d32bc5d11308620e0a6110ab7e77a4e33acd Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 27 Jan 2019 18:12:41 +0100 Subject: [PATCH] Fix that bots don't re-use capturers They were never removed from activeCapturers when their target becomes invalid, preventing the bot from reusing them. --- .../Traits/BotModules/CaptureManagerBotModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs index 7907a481b6..63a2f7f573 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/CaptureManagerBotModule.cs @@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits readonly World world; readonly Player player; readonly Func isEnemyUnit; - readonly Predicate unitCannotBeOrdered; + readonly Predicate unitCannotBeOrderedOrIsIdle; readonly int maximumCaptureTargetOptions; int minCaptureDelayTicks; @@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits && !unit.Info.HasTraitInfo() && unit.Info.HasTraitInfo(); - unitCannotBeOrdered = a => a.Owner != player || a.IsDead || !a.IsInWorld; + unitCannotBeOrderedOrIsIdle = a => a.Owner != player || a.IsDead || !a.IsInWorld || a.IsIdle; maximumCaptureTargetOptions = Math.Max(1, Info.MaximumCaptureTargetOptions); } @@ -118,7 +118,7 @@ namespace OpenRA.Mods.Common.Traits if (!Info.CapturingActorTypes.Any() || player.WinState != WinState.Undefined) return; - activeCapturers.RemoveAll(unitCannotBeOrdered); + activeCapturers.RemoveAll(unitCannotBeOrderedOrIsIdle); var newUnits = world.ActorsHavingTrait() .Where(a => a.Owner == player && !activeCapturers.Contains(a));