diff --git a/OpenRA.Game/Traits/Activities/Move.cs b/OpenRA.Game/Traits/Activities/Move.cs index a9e9ed5453..dfa7534715 100755 --- a/OpenRA.Game/Traits/Activities/Move.cs +++ b/OpenRA.Game/Traits/Activities/Move.cs @@ -151,8 +151,19 @@ namespace OpenRA.Traits.Activities } bool hasWaited; + bool hasNudged; int waitTicksRemaining; + void NudgeBlocker(Actor self, int2 nextCell) + { + var blocker = self.World.WorldActor.traits.Get().GetUnitsAt(nextCell).FirstOrDefault(); + if (blocker == null) return; + + var nudge = blocker.traits.GetOrDefault(); + if (nudge != null) + nudge.OnNudge(blocker); + } + int2? PopPath( Actor self, Mobile mobile ) { if( path.Count == 0 ) return null; @@ -165,6 +176,12 @@ namespace OpenRA.Traits.Activities return null; } + if (!hasNudged) + { + NudgeBlocker(self, nextCell); + hasNudged = true; + } + if (!hasWaited) { var info = self.Info.Traits.Get(); @@ -187,6 +204,7 @@ namespace OpenRA.Traits.Activities return null; } + hasNudged = false; hasWaited = false; path.RemoveAt( path.Count - 1 ); return nextCell; diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 8326c57eea..42c358953a 100644 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -53,6 +53,7 @@ namespace OpenRA.Traits public interface IDisable { bool Disabled { get; } } public interface IExplodeModifier { bool ShouldExplode(Actor self); } + public interface INudge { bool OnNudge(Actor self); } public interface IOccupySpace {