From fbda9dc1b1904a5ca54d7814d867d8bd50d25d8f Mon Sep 17 00:00:00 2001 From: penev92 Date: Sun, 14 Dec 2014 02:32:01 +0200 Subject: [PATCH] Fix worms getting stuck when target reaches rock --- OpenRA.Mods.RA/Activities/Attack.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenRA.Mods.RA/Activities/Attack.cs b/OpenRA.Mods.RA/Activities/Attack.cs index 671436eb40..818c34267b 100755 --- a/OpenRA.Mods.RA/Activities/Attack.cs +++ b/OpenRA.Mods.RA/Activities/Attack.cs @@ -23,6 +23,7 @@ namespace OpenRA.Mods.RA.Activities readonly IFacing facing; readonly WRange minRange; readonly WRange maxRange; + readonly IPositionable positionable; public Attack(Actor self, Target target, WRange minRange, WRange maxRange, bool allowMovement) { @@ -32,6 +33,7 @@ namespace OpenRA.Mods.RA.Activities attack = self.Trait(); facing = self.Trait(); + positionable = self.Trait(); move = allowMovement ? self.TraitOrDefault() : null; } @@ -51,6 +53,9 @@ namespace OpenRA.Mods.RA.Activities 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