Ticket #3466: ticket3466.diff

File ticket3466.diff, 1.5 KB (added by mimo, 9 years ago)

reverting r17086 and better fix for #3430

  • binaries/data/mods/public/simulation/components/UnitAI.js

     
    14311431                // remain idle
    14321432                this.StartTimer(1000);
    14331433
     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
    14341440                // If a unit can heal and attack we first want to heal wounded units,
    14351441                // so check if we are a healer and find whether there's anybody nearby to heal.
    14361442                // (If anyone approaches later it'll be handled via LosHealRangeUpdate.)
     
    35483554    }
    35493555    else
    35503556    {
    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");
    35593558
    35603559        Engine.PostMessage(this.entity, MT_UnitAIOrderDataChanged, { "to": this.GetOrderData() });
    35613560