Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/BuildingAI.js
Show All 24 Lines | |||||
BuildingAI.prototype.Init = function() | BuildingAI.prototype.Init = function() | ||||
{ | { | ||||
this.currentRound = 0; | this.currentRound = 0; | ||||
this.archersGarrisoned = 0; | this.archersGarrisoned = 0; | ||||
this.arrowsLeft = 0; | this.arrowsLeft = 0; | ||||
this.targetUnits = []; | this.targetUnits = []; | ||||
}; | }; | ||||
BuildingAI.prototype.Update = function(newTemplate) | |||||
{ | |||||
this.template = newTemplate; | |||||
this.targetUnits = []; | |||||
this.SetupRangeQuery(); | |||||
this.SetupGaiaRangeQuery(); | |||||
}; | |||||
BuildingAI.prototype.OnGarrisonedUnitsChanged = function(msg) | BuildingAI.prototype.OnGarrisonedUnitsChanged = function(msg) | ||||
{ | { | ||||
let classes = this.template.GarrisonArrowClasses; | let classes = this.template.GarrisonArrowClasses; | ||||
for (let ent of msg.added) | for (let ent of msg.added) | ||||
{ | { | ||||
let cmpIdentity = Engine.QueryInterface(ent, IID_Identity); | let cmpIdentity = Engine.QueryInterface(ent, IID_Identity); | ||||
if (cmpIdentity && MatchesClassList(cmpIdentity.GetClassesList(), classes)) | if (cmpIdentity && MatchesClassList(cmpIdentity.GetClassesList(), classes)) | ||||
++this.archersGarrisoned; | ++this.archersGarrisoned; | ||||
▲ Show 20 Lines • Show All 344 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator