Harvs built by HackyAI now call FindResources
This commit is contained in:
@@ -14,6 +14,7 @@ using System.Linq;
|
|||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Mods.RA.Buildings;
|
using OpenRA.Mods.RA.Buildings;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Mods.RA.Activities;
|
||||||
using XRandom = OpenRA.Thirdparty.Random;
|
using XRandom = OpenRA.Thirdparty.Random;
|
||||||
|
|
||||||
|
|
||||||
@@ -239,18 +240,23 @@ namespace OpenRA.Mods.RA
|
|||||||
else
|
else
|
||||||
assignRolesTicks = Info.AssignRolesInterval;
|
assignRolesTicks = Info.AssignRolesInterval;
|
||||||
|
|
||||||
// don't select harvesters.
|
|
||||||
var newUnits = self.World.ActorsWithTrait<IMove>()
|
var newUnits = self.World.ActorsWithTrait<IMove>()
|
||||||
.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))
|
&& !activeUnits.Contains(a.Actor))
|
||||||
.Select(a => a.Actor).ToArray();
|
.Select(a => a.Actor).ToArray();
|
||||||
|
|
||||||
foreach (var a in newUnits)
|
foreach (var a in newUnits)
|
||||||
{
|
{
|
||||||
BotDebug("AI: Found a newly built unit");
|
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);
|
activeUnits.Add(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Create an attack force when we have enough units around our base. */
|
/* Create an attack force when we have enough units around our base. */
|
||||||
// (don't bother leaving any behind for defense.)
|
// (don't bother leaving any behind for defense.)
|
||||||
|
|||||||
Reference in New Issue
Block a user