Ticket #3466: ticket3466.diff
File ticket3466.diff, 1.5 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/simulation/components/UnitAI.js
1431 1431 // remain idle 1432 1432 this.StartTimer(1000); 1433 1433 1434 // If we have some orders, it is because we are in an intermediary state from FinishOrder 1435 // (SetNextState("IDLE") is only executed when we get a ProcessMessage) 1436 // and thus we should not start an attack which would put us in a weird state 1437 if (this.orderQueue.length > 0) 1438 return false; 1439 1434 1440 // If a unit can heal and attack we first want to heal wounded units, 1435 1441 // so check if we are a healer and find whether there's anybody nearby to heal. 1436 1442 // (If anyone approaches later it'll be handled via LosHealRangeUpdate.) … … 3548 3554 } 3549 3555 else 3550 3556 { 3551 // We must switch to the idle state immediately (and not do a simple SetNextState) 3552 // otherwise we may be in a weird state if a ProcessMessage is triggered (by a MoveStarted 3553 // or MoveCompleted) when starting a new order and before we have set our new state. 3554 let index = this.GetCurrentState().indexOf("."); 3555 if (index != -1) 3556 this.UnitFsm.SwitchToNextState(this, this.GetCurrentState().slice(0,index+1) + "IDLE"); 3557 else 3558 this.SetNextState("IDLE"); // should never happen 3557 this.SetNextState("IDLE"); 3559 3558 3560 3559 Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() }); 3561 3560