2567 | | // Clean up any timers that are now obsolete |
2568 | | this.StopTimer(); |
2569 | | |
2570 | | // clear up the ResourceSupply gatherer count. |
2571 | | if (this.gatheringTarget) |
2572 | | { |
2573 | | var cmpSupply = Engine.QueryInterface(this.gatheringTarget, IID_ResourceSupply); |
2574 | | if (cmpSupply) |
2575 | | cmpSupply.RemoveGatherer(this.entity); |
2576 | | delete this.gatheringTarget; |
2577 | | } |
| 2567 | // Go to an "empty" state to properly close the present state (e.g. call its leave function) |
| 2568 | var nextState = this.GetCurrentState(); |
| 2569 | if (nextState.indexOf(".") != -1) |
| 2570 | UnitFsm.SwitchToNextState(this, nextState.slice(0, nextState.indexOf("."))); |