fix minelayer going to faraway FIX

This commit is contained in:
Chris Forbes
2011-05-02 21:38:16 +12:00
parent 093f159d8e
commit 00e9015671

View File

@@ -30,8 +30,10 @@ namespace OpenRA.Mods.RA.Activities
{
// rearm & repair at fix, then back out here to refill the minefield some more
var buildings = self.Info.Traits.Get<MinelayerInfo>().RearmBuildings;
var rearmTarget = self.World.Actors.FirstOrDefault(a => a.Owner != null && self.Owner.Stances[a.Owner] == Stance.Ally
&& buildings.Contains(a.Info.Name));
var rearmTarget = self.World.Actors.Where(a => a.Owner != null && self.Owner.Stances[a.Owner] == Stance.Ally
&& buildings.Contains(a.Info.Name))
.OrderBy( a => (a.Location - self.Location).LengthSquared )
.FirstOrDefault();
if (rearmTarget == null)
return new Wait(20);