Ticket #2353: work_orders_under_alert.2.patch

File work_orders_under_alert.2.patch, 1.5 KB (added by Itms, 10 years ago)
  • binaries/data/mods/public/simulation/components/UnitAI.js

     
    698698
    699699    "Order.Alert": function(msg) {
    700700        this.alertRaiser = this.order.data.raiser;
     701        this.isUnderAlert = true;
    701702       
    702703        // Find a target to garrison into, if we don't already have one
    703704        if (!this.alertGarrisoningTarget)
     
    30503051    this.isGuardOf = undefined;
    30513052
    30523053    // "Town Bell" behaviour
     3054    this.isUnderAlert = false;
    30533055    this.alertRaiser = undefined;
    30543056    this.alertGarrisoningTarget = undefined;
    30553057
     
    30673069
    30683070UnitAI.prototype.IsUnderAlert = function()
    30693071{
    3070     return this.alertGarrisoningTarget != undefined;
     3072    return this.isUnderAlert;
    30713073};
    30723074
    30733075UnitAI.prototype.ResetAlert = function()
    30743076{
    30753077    this.alertGarrisoningTarget = undefined;
     3078    this.isUnderAlert = false;
    30763079};
    30773080
    30783081UnitAI.prototype.IsFormationController = function()
     
    35703573
    35713574UnitAI.prototype.UpdateWorkOrders = function(type)
    35723575{
     3576    // Under alert, remembered work orders won't be forgotten
     3577    if (this.IsUnderAlert())
     3578        return;
     3579   
    35733580    var isWorkType = function(type){
    35743581        return (type == "Gather" || type == "Trade" || type == "Repair" || type == "ReturnResource");
    35753582    };
    35763583   
    3577     // If we are being reaffected to a work order, forgot the previous ones
     3584    // If we are being re-affected to a work order, forget the previous ones
    35783585    if (isWorkType(type))
    35793586    {
    35803587        this.workOrders = [];