Make Attack use ChildActivities

This commit is contained in:
tovl
2019-02-16 19:56:28 +01:00
committed by Oliver Brakmann
parent 5ec47b47af
commit 6f213dddec
3 changed files with 32 additions and 58 deletions

View File

@@ -29,16 +29,16 @@ namespace OpenRA.Mods.Common.Activities
this.maxRange = maxRange;
}
protected override bool ShouldStop(Actor self, CPos oldTargetPosition)
protected override bool ShouldStop(Actor self)
{
// 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);
}
protected override bool ShouldRepath(Actor self, CPos oldTargetPosition)
protected override bool ShouldRepath(Actor self, CPos targetLocation)
{
return lastVisibleTargetLocation != oldTargetPosition && (!AtCorrectRange(self.CenterPosition)
return lastVisibleTargetLocation != targetLocation && (!AtCorrectRange(self.CenterPosition)
|| !Mobile.CanInteractWithGroundLayer(self));
}