Merge pull request #11515 from reaperrr/fix-wanders

Fix Wanders always triggering move at first game tick
This commit is contained in:
Oliver Brakmann
2016-06-24 20:47:48 +02:00
committed by GitHub

View File

@@ -39,6 +39,7 @@ namespace OpenRA.Mods.Common.Traits
int countdown;
int ticksIdle;
int effectiveMoveRadius;
bool firstTick = true;
public Wanders(Actor self, WandersInfo info)
{
@@ -52,8 +53,15 @@ namespace OpenRA.Mods.Common.Traits
countdown = self.World.SharedRandom.Next(info.MinMoveDelay, info.MaxMoveDelay);
}
public void TickIdle(Actor self)
public virtual void TickIdle(Actor self)
{
// The countdown has not have been set at this point, so don't check yet
if (firstTick)
{
firstTick = false;
return;
}
if (--countdown > 0)
return;