Skip to content

Commit

Permalink
Merge pull request #7126 from penev92/bleed_sandworm
Browse files Browse the repository at this point in the history
Fix worms not releasing targets when they move deep onto rock
  • Loading branch information
pchote committed Dec 22, 2014
2 parents f352aed + fbda9dc commit e212517
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions OpenRA.Mods.RA/Activities/Attack.cs
Expand Up @@ -24,6 +24,7 @@ public class Attack : Activity
readonly IFacing facing;
readonly WRange minRange;
readonly WRange maxRange;
readonly IPositionable positionable;

public Attack(Actor self, Target target, WRange minRange, WRange maxRange, bool allowMovement)
{
Expand All @@ -33,6 +34,7 @@ public Attack(Actor self, Target target, WRange minRange, WRange maxRange, bool

attack = self.Trait<AttackBase>();
facing = self.Trait<IFacing>();
positionable = self.Trait<IPositionable>();

move = allowMovement ? self.TraitOrDefault<IMove>() : null;
}
Expand All @@ -52,6 +54,9 @@ protected virtual Activity InnerTick(Actor self, AttackBase attack)
var type = Target.Type;
if (!Target.IsValidFor(self) || type == TargetType.FrozenActor)
return NextActivity;

if (attack.Info.AttackRequiresEnteringCell && !positionable.CanEnterCell(Target.Actor.Location, null, false))
return NextActivity;

// Drop the target if it moves under the shroud / fog.
// HACK: This would otherwise break targeting frozen actors
Expand Down

0 comments on commit e212517

Please sign in to comment.