Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Attack.js
Show First 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | "<element>" + | ||||
"</interleave>" + | "</interleave>" + | ||||
"</element>" + | "</element>" + | ||||
"</oneOrMore>"; | "</oneOrMore>"; | ||||
Attack.prototype.Init = function() | Attack.prototype.Init = function() | ||||
{ | { | ||||
}; | }; | ||||
Attack.prototype.Update = function(newTemplate) { | |||||
this.template = newTemplate; | |||||
// TODO: this should probably be done in UnitAI directly instead. | |||||
let cmpUnitAI = Engine.QueryInterface(this.entity, IID_UnitAI); | |||||
if (cmpUnitAI) | |||||
cmpUnitAI.UpdateRangeQueries(); | |||||
}; | |||||
Attack.prototype.GetAttackTypes = function(wantedTypes) | Attack.prototype.GetAttackTypes = function(wantedTypes) | ||||
{ | { | ||||
let types = g_AttackTypes.filter(type => !!this.template[type]); | let types = g_AttackTypes.filter(type => !!this.template[type]); | ||||
if (!wantedTypes) | if (!wantedTypes) | ||||
return types; | return types; | ||||
let wantedTypesReal = wantedTypes.filter(wtype => wtype.indexOf("!") != 0); | let wantedTypesReal = wantedTypes.filter(wtype => wtype.indexOf("!") != 0); | ||||
return types.filter(type => wantedTypes.indexOf("!" + type) == -1 && | return types.filter(type => wantedTypes.indexOf("!" + type) == -1 && | ||||
▲ Show 20 Lines • Show All 565 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator