From 2cc6a67a95bab13a37422b6db09add579ab39b05 Mon Sep 17 00:00:00 2001 From: Curtis S Date: Sat, 10 Sep 2011 22:40:06 -0600 Subject: [PATCH] Harvs built by HackyAI now call FindResources --- OpenRA.Mods.RA/HackyAI.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.RA/HackyAI.cs b/OpenRA.Mods.RA/HackyAI.cs index ea0e079e30..670428a0c5 100644 --- a/OpenRA.Mods.RA/HackyAI.cs +++ b/OpenRA.Mods.RA/HackyAI.cs @@ -14,6 +14,7 @@ using System.Linq; using OpenRA.FileFormats; using OpenRA.Mods.RA.Buildings; using OpenRA.Traits; +using OpenRA.Mods.RA.Activities; using XRandom = OpenRA.Thirdparty.Random; @@ -239,18 +240,23 @@ namespace OpenRA.Mods.RA else assignRolesTicks = Info.AssignRolesInterval; - // don't select harvesters. var newUnits = self.World.ActorsWithTrait() - .Where(a => a.Actor.Owner == p && a.Actor.Info != Rules.Info["harv"] && a.Actor.Info != Rules.Info["mcv"] + .Where(a => a.Actor.Owner == p && a.Actor.Info != Rules.Info["mcv"] && !activeUnits.Contains(a.Actor)) .Select(a => a.Actor).ToArray(); foreach (var a in newUnits) { BotDebug("AI: Found a newly built unit"); - unitsHangingAroundTheBase.Add(a); + if (a.Info == Rules.Info["harv"]) + a.QueueActivity(new FindResources()); + + else + unitsHangingAroundTheBase.Add(a); + activeUnits.Add(a); } + /* Create an attack force when we have enough units around our base. */ // (don't bother leaving any behind for defense.)