Ticket #3430: ticket3430.patch
File ticket3430.patch, 1.3 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/simulation/components/UnitAI.js
2340 2340 2341 2341 // If hunting, try to go to the initial herd position to see if we are more lucky 2342 2342 if (herdPos) 2343 { 2343 2344 this.GatherNearPosition(herdPos.x, herdPos.z, resourceType, resourceTemplate); 2345 return; 2346 } 2344 2347 2345 2348 // Nothing else to gather - if we're carrying anything then we should 2346 2349 // drop it off, and if not then we might as well head to the dropsite … … 3530 3533 } 3531 3534 else 3532 3535 { 3533 this.SetNextState("IDLE"); 3536 // We must switch to the idle state immediately (and not do a simple SetNextState) 3537 // otherwise we may be in a weird state if a ProcessMessage is triggered (by a MoveStarted 3538 // or MoveCompleted) when starting a new order and before we have set our new state. 3539 let index = this.GetCurrentState().indexOf("."); 3540 if (index != -1) 3541 this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index+1) + "IDLE"); 3542 else 3543 this.SetNextState("IDLE"); // should never happen 3534 3544 3535 3545 Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); 3536 3546