Fix units stuck on transit-only when resupplying

This commit is contained in:
Adam Mitchell
2020-04-11 17:59:30 +01:00
committed by reaperrr
parent 942dd0e5f7
commit 0a9eb1ff83
5 changed files with 23 additions and 5 deletions

View File

@@ -33,13 +33,13 @@ namespace OpenRA.Mods.Common.Activities
{
// We are now in range. Don't move any further!
// HACK: This works around the pathfinder not returning the shortest path
return AtCorrectRange(self.CenterPosition) && Mobile.CanInteractWithGroundLayer(self);
return AtCorrectRange(self.CenterPosition) && Mobile.CanInteractWithGroundLayer(self) && Mobile.CanStayInCell(self.Location);
}
protected override bool ShouldRepath(Actor self, CPos targetLocation)
{
return lastVisibleTargetLocation != targetLocation && (!AtCorrectRange(self.CenterPosition)
|| !Mobile.CanInteractWithGroundLayer(self));
|| !Mobile.CanInteractWithGroundLayer(self) || !Mobile.CanStayInCell(self.Location));
}
protected override IEnumerable<CPos> CandidateMovementCells(Actor self)
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Activities
var minCells = minRange.Length / 1024;
return map.FindTilesInAnnulus(lastVisibleTargetLocation, minCells, maxCells)
.Where(c => AtCorrectRange(map.CenterOfSubCell(c, Mobile.FromSubCell)));
.Where(c => Mobile.CanStayInCell(c) && AtCorrectRange(map.CenterOfSubCell(c, Mobile.FromSubCell)));
}
bool AtCorrectRange(WPos origin)