Ticket #2342: patch_alert_autogarrison.patch
File patch_alert_autogarrison.patch, 2.8 KB (added by , 10 years ago) |
---|
-
binaries/data/mods/public/simulation/components/AlertRaiser.js
34 34 PlaySound(alertString, this.entity); 35 35 }; 36 36 37 AlertRaiser.prototype. IncreaseAlertLevel= function()37 AlertRaiser.prototype.UpdateUnits = function() 38 38 { 39 if(!this.CanIncreaseLevel())40 return false;41 42 39 // Find units owned by this unit's player 43 40 var players = []; 44 41 var cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership); 45 42 if (cmpOwnership) 46 43 players = [cmpOwnership.GetOwner()]; 47 48 this.level++;49 this.SoundAlert();50 44 51 45 // Select units to put under alert, ignoring domestic animals (NB : war dogs are not domestic) 52 46 var rangeMan = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); … … 62 56 cmpUnitAI.ReplaceOrder("Alert", {"raiser": this.entity, "force": true}); 63 57 this.walkingUnits.push(unit); 64 58 } 59 } 60 61 AlertRaiser.prototype.IncreaseAlertLevel = function() 62 { 63 if(!this.CanIncreaseLevel()) 64 return false; 65 66 this.level++; 67 this.SoundAlert(); 65 68 69 this.UpdateUnits(); 70 66 71 return true; 67 72 }; 68 73 … … 72 77 73 78 var index = this.walkingUnits.indexOf(msg.unit); 74 79 if (index != -1) 75 this.walkingUnits.splice(index, 1); 76 80 this.walkingUnits.splice(index, 1); 77 81 } 78 82 83 AlertRaiser.prototype.OnGlobalTrainingFinished = function(msg) 84 { 85 this.UpdateUnits(); 86 } 87 79 88 AlertRaiser.prototype.EndOfAlert = function() 80 89 { 81 90 this.level = 0; -
binaries/data/mods/public/simulation/components/interfaces/ProductionQueue.js
7 7 // Message of the form { entities: [id, ...], metadata: ... } 8 8 // sent to the current entity whenever a unit has been trained. 9 9 Engine.RegisterMessageType("TrainingFinished"); 10 11 // Message of the form { } broadcasted whenever a unit has been trained. 12 Engine.RegisterMessageType("GlobalTrainingFinished"); -
binaries/data/mods/public/simulation/components/ProductionQueue.js
592 592 "owner": cmpOwnership.GetOwner(), 593 593 "metadata": metadata, 594 594 }); 595 596 Engine.BroadcastMessage(MT_GlobalTrainingFinished, {}); 595 597 } 596 598 597 599 return createdEnts.length;