Ticket #2353: work_orders_under_alert.2.patch
File work_orders_under_alert.2.patch, 1.5 KB (added by , 10 years ago) |
---|
-
binaries/data/mods/public/simulation/components/UnitAI.js
698 698 699 699 "Order.Alert": function(msg) { 700 700 this.alertRaiser = this.order.data.raiser; 701 this.isUnderAlert = true; 701 702 702 703 // Find a target to garrison into, if we don't already have one 703 704 if (!this.alertGarrisoningTarget) … … 3050 3051 this.isGuardOf = undefined; 3051 3052 3052 3053 // "Town Bell" behaviour 3054 this.isUnderAlert = false; 3053 3055 this.alertRaiser = undefined; 3054 3056 this.alertGarrisoningTarget = undefined; 3055 3057 … … 3067 3069 3068 3070 UnitAI.prototype.IsUnderAlert = function() 3069 3071 { 3070 return this. alertGarrisoningTarget != undefined;3072 return this.isUnderAlert; 3071 3073 }; 3072 3074 3073 3075 UnitAI.prototype.ResetAlert = function() 3074 3076 { 3075 3077 this.alertGarrisoningTarget = undefined; 3078 this.isUnderAlert = false; 3076 3079 }; 3077 3080 3078 3081 UnitAI.prototype.IsFormationController = function() … … 3570 3573 3571 3574 UnitAI.prototype.UpdateWorkOrders = function(type) 3572 3575 { 3576 // Under alert, remembered work orders won't be forgotten 3577 if (this.IsUnderAlert()) 3578 return; 3579 3573 3580 var isWorkType = function(type){ 3574 3581 return (type == "Gather" || type == "Trade" || type == "Repair" || type == "ReturnResource"); 3575 3582 }; 3576 3583 3577 // If we are being re affected to a work order, forgot the previous ones3584 // If we are being re-affected to a work order, forget the previous ones 3578 3585 if (isWorkType(type)) 3579 3586 { 3580 3587 this.workOrders = [];