Fix immovable actors not dropping targets that are out of range
This commit is contained in:
@@ -76,9 +76,13 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
minRange = armaments.Max(a => a.Weapon.MinRange);
|
minRange = armaments.Max(a => a.Weapon.MinRange);
|
||||||
maxRange = armaments.Min(a => a.MaxRange());
|
maxRange = armaments.Min(a => a.MaxRange());
|
||||||
|
|
||||||
// Try to move within range
|
if (!Target.IsInRange(self.CenterPosition, maxRange) || Target.IsInRange(self.CenterPosition, minRange))
|
||||||
if (move != null && (!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);
|
return ActivityUtils.SequenceActivities(move.MoveWithinRange(Target, minRange, maxRange), this);
|
||||||
|
}
|
||||||
|
|
||||||
var desiredFacing = (Target.CenterPosition - self.CenterPosition).Yaw.Facing;
|
var desiredFacing = (Target.CenterPosition - self.CenterPosition).Yaw.Facing;
|
||||||
if (facing.Facing != desiredFacing)
|
if (facing.Facing != desiredFacing)
|
||||||
|
|||||||
Reference in New Issue
Block a user