Simplified initial Wanders countdown initialization
I don't see a technical reason for the old approach.
This commit is contained in:
@@ -39,7 +39,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
int countdown;
|
int countdown;
|
||||||
int ticksIdle;
|
int ticksIdle;
|
||||||
int effectiveMoveRadius;
|
int effectiveMoveRadius;
|
||||||
bool firstTick = true;
|
|
||||||
|
|
||||||
public Wanders(Actor self, WandersInfo info)
|
public Wanders(Actor self, WandersInfo info)
|
||||||
: base(info)
|
: base(info)
|
||||||
@@ -47,6 +46,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
this.self = self;
|
this.self = self;
|
||||||
this.info = info;
|
this.info = info;
|
||||||
effectiveMoveRadius = info.WanderMoveRadius;
|
effectiveMoveRadius = info.WanderMoveRadius;
|
||||||
|
countdown = self.World.SharedRandom.Next(info.MinMoveDelay, info.MaxMoveDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Created(Actor self)
|
protected override void Created(Actor self)
|
||||||
@@ -71,14 +71,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (IsTraitDisabled)
|
if (IsTraitDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// OnBecomingIdle has not been called yet at this point, so set the initial countdown here
|
|
||||||
if (firstTick)
|
|
||||||
{
|
|
||||||
countdown = self.World.SharedRandom.Next(info.MinMoveDelay, info.MaxMoveDelay);
|
|
||||||
firstTick = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (--countdown > 0)
|
if (--countdown > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user