Index: ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js +++ ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js @@ -3536,7 +3536,6 @@ this.UnitFsm.SetNextState(this, state); }; - UnitAI.prototype.DeferMessage = function(msg) { this.UnitFsm.DeferMessage(this, msg); @@ -3592,7 +3591,11 @@ this.orderQueue = []; this.order = undefined; - this.SetNextState("IDLE"); + + // Switch to IDLE as a default state, but only if our current state is not IDLE + // as this can trigger infinite loops by entering IDLE repeatedly. + if (!this.GetCurrentState().endsWith(".IDLE")) + this.SetNextState("IDLE"); Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });