Fix all wandering actors wandering at first game tick
NotifyBecomingIdle is only notified at the first idle tick, so `countdown` is not set when TickIdle checks it at first game tick. Therefore, we let TickIdle return early at first game tick to avoid that.
This commit is contained in:
@@ -39,6 +39,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
int countdown;
|
||||
int ticksIdle;
|
||||
int effectiveMoveRadius;
|
||||
bool firstTick = true;
|
||||
|
||||
public Wanders(Actor self, WandersInfo info)
|
||||
{
|
||||
@@ -54,6 +55,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public 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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user