diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index 2f17e32a09..1e090eb923 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -200,7 +200,7 @@ namespace OpenRA.Graphics } } - if (ShowUnitPaths) + //if (ShowUnitPaths) { var mobile = selectedUnit.traits.GetOrDefault(); if (mobile != null) diff --git a/OpenRA.Game/Traits/Activities/Move.cs b/OpenRA.Game/Traits/Activities/Move.cs index 20ab3ddefc..60c6a686f0 100755 --- a/OpenRA.Game/Traits/Activities/Move.cs +++ b/OpenRA.Game/Traits/Activities/Move.cs @@ -151,6 +151,9 @@ namespace OpenRA.Traits.Activities throw new InvalidOperationException( "(Move) Sanity check failed" ); } + bool hasWaited; + int waitTicksRemaining; + int2? PopPath( Actor self, Mobile mobile ) { if( path.Count == 0 ) return null; @@ -163,6 +166,16 @@ namespace OpenRA.Traits.Activities return null; } + if (!hasWaited) + { + var info = self.Info.Traits.Get(); + waitTicksRemaining = info.WaitAverage + self.World.SharedRandom.Next(-info.WaitSpread, info.WaitSpread); + hasWaited = true; + } + + if (--waitTicksRemaining >= 0) + return null; + self.World.WorldActor.traits.Get().Remove( self, mobile ); var newPath = getPath(self, mobile).TakeWhile(a => a != self.Location).ToList(); @@ -172,6 +185,7 @@ namespace OpenRA.Traits.Activities return null; } + hasWaited = false; path.RemoveAt( path.Count - 1 ); return nextCell; } diff --git a/OpenRA.Game/Traits/Mobile.cs b/OpenRA.Game/Traits/Mobile.cs index 71e1c5b7d3..3401102b33 100644 --- a/OpenRA.Game/Traits/Mobile.cs +++ b/OpenRA.Game/Traits/Mobile.cs @@ -26,6 +26,8 @@ namespace OpenRA.Traits public class MobileInfo : ITraitInfo { public readonly UnitMovementType MovementType = UnitMovementType.Wheel; + public readonly int WaitAverage = 60; + public readonly int WaitSpread = 20; public object Create(Actor self) { return new Mobile(self); } }