Fix target invalidation and reacquisition in MoveAdjacentTo.

This commit is contained in:
Paul Chote
2019-01-13 16:36:30 +00:00
parent d03c5b1c48
commit 975821023d
2 changed files with 56 additions and 50 deletions

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Activities
protected override bool ShouldRepath(Actor self, CPos oldTargetPosition)
{
return targetPosition != oldTargetPosition && (!AtCorrectRange(self.CenterPosition)
return lastVisibleTargetLocation != oldTargetPosition && (!AtCorrectRange(self.CenterPosition)
|| !Mobile.CanInteractWithGroundLayer(self));
}
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Activities
var maxCells = (maxRange.Length + 1023) / 1024;
var minCells = minRange.Length / 1024;
return map.FindTilesInAnnulus(targetPosition, minCells, maxCells)
return map.FindTilesInAnnulus(lastVisibleTargetLocation, minCells, maxCells)
.Where(c => AtCorrectRange(map.CenterOfSubCell(c, Mobile.FromSubCell)));
}