Fix immovable actors not dropping targets that are out of range

This commit is contained in:
teees
2015-11-03 15:35:52 +01:00
committed by Oliver Brakmann
parent 2debda926a
commit e95cb7540d

View File

@@ -76,9 +76,13 @@ namespace OpenRA.Mods.Common.Activities
minRange = armaments.Max(a => a.Weapon.MinRange);
maxRange = armaments.Min(a => a.MaxRange());
// Try to move within range
if (move != null && (!Target.IsInRange(self.CenterPosition, maxRange) || Target.IsInRange(self.CenterPosition, minRange)))
if (!Target.IsInRange(self.CenterPosition, maxRange) || Target.IsInRange(self.CenterPosition, minRange))
{
// Try to move within range, drop the target otherwise
if (move == null)
return NextActivity;
return ActivityUtils.SequenceActivities(move.MoveWithinRange(Target, minRange, maxRange), this);
}
var desiredFacing = (Target.CenterPosition - self.CenterPosition).Yaw.Facing;
if (facing.Facing != desiredFacing)