Use Util.AdjacentCells to determine ExternalCapture validity.

This matches the set of cells targeted by MoveAdjacentTo.
This commit is contained in:
Paul Chote
2017-12-17 12:31:55 +00:00
parent 85c54e04d9
commit 30cafcbc25

View File

@@ -9,6 +9,7 @@
*/ */
#endregion #endregion
using System.Linq;
using OpenRA.Activities; using OpenRA.Activities;
using OpenRA.Mods.Common.Effects; using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits;
@@ -42,9 +43,7 @@ namespace OpenRA.Mods.Common.Activities
return NextActivity; return NextActivity;
} }
var nearest = target.Actor.OccupiesSpace.NearestCellTo(mobile.ToCell); if (!Util.AdjacentCells(self.World, target).Contains(mobile.ToCell))
if ((nearest - mobile.ToCell).LengthSquared > 2)
return ActivityUtils.SequenceActivities(new MoveAdjacentTo(self, target), this); return ActivityUtils.SequenceActivities(new MoveAdjacentTo(self, target), this);
if (!capturable.CaptureInProgress) if (!capturable.CaptureInProgress)