Ticket #2353: work_orders_under_alert.3.patch
File work_orders_under_alert.3.patch, 2.2 KB (added by , 10 years ago) |
---|
-
binaries/data/mods/public/simulation/components/GarrisonHolder.js
247 247 Engine.PostMessage(this.entity, MT_GarrisonedUnitsChanged, { "added" : [entity], "removed": [] }); 248 248 249 249 var cmpUnitAI = Engine.QueryInterface(entity, IID_UnitAI); 250 if (cmpUnitAI && cmpUnitAI. GetAlertRaiser())250 if (cmpUnitAI && cmpUnitAI.IsUnderAlert()) 251 251 Engine.PostMessage(cmpUnitAI.GetAlertRaiser(), MT_UnitGarrisonedAfterAlert, {"holder": this.entity, "unit": entity}); 252 252 253 253 return true; -
binaries/data/mods/public/simulation/components/UnitAI.js
3067 3067 3068 3068 UnitAI.prototype.IsUnderAlert = function() 3069 3069 { 3070 return this.alert GarrisoningTarget!= undefined;3070 return this.alertRaiser != undefined; 3071 3071 }; 3072 3072 3073 3073 UnitAI.prototype.ResetAlert = function() 3074 3074 { 3075 3075 this.alertGarrisoningTarget = undefined; 3076 this.alertRaiser = undefined; 3076 3077 }; 3077 3078 3079 UnitAI.prototype.GetAlertRaiser = function() 3080 { 3081 return this.alertRaiser; 3082 }; 3083 3078 3084 UnitAI.prototype.IsFormationController = function() 3079 3085 { 3080 3086 return (this.template.FormationController == "true"); … … 3570 3576 3571 3577 UnitAI.prototype.UpdateWorkOrders = function(type) 3572 3578 { 3579 // Under alert, remembered work orders won't be forgotten 3580 if (this.IsUnderAlert()) 3581 return; 3582 3573 3583 var isWorkType = function(type){ 3574 3584 return (type == "Gather" || type == "Trade" || type == "Repair" || type == "ReturnResource"); 3575 3585 }; 3576 3586 3577 // If we are being re affected to a work order, forgot the previous ones3587 // If we are being re-affected to a work order, forget the previous ones 3578 3588 if (isWorkType(type)) 3579 3589 { 3580 3590 this.workOrders = []; … … 3656 3666 this.workOrders = orders; 3657 3667 }; 3658 3668 3659 UnitAI.prototype.GetAlertRaiser = function()3660 {3661 return this.alertRaiser;3662 };3663 3664 3669 UnitAI.prototype.TimerHandler = function(data, lateness) 3665 3670 { 3666 3671 // Reset the timer