Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/BuildingAI.js
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | BuildingAI.prototype.SetupRangeQuery = function() | ||||
if (enemies.length && enemies[0] == 0) | if (enemies.length && enemies[0] == 0) | ||||
enemies.shift(); // remove gaia | enemies.shift(); // remove gaia | ||||
if (!enemies.length) | if (!enemies.length) | ||||
return; | return; | ||||
var range = cmpAttack.GetRange(attackType); | var range = cmpAttack.GetRange(attackType); | ||||
this.enemyUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery( | this.enemyUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery( | ||||
this.entity, range.min, range.max, range.elevationBonus, | this.entity, range.min, range.max, range.elevationBonus, | ||||
enemies, IID_Resistance, cmpRangeManager.GetEntityFlagMask("normal")); | enemies, IID_Attackable, cmpRangeManager.GetEntityFlagMask("normal")); | ||||
cmpRangeManager.EnableActiveQuery(this.enemyUnitsQuery); | cmpRangeManager.EnableActiveQuery(this.enemyUnitsQuery); | ||||
}; | }; | ||||
// Set up a range query for Gaia units within LOS range which can be attacked. | // Set up a range query for Gaia units within LOS range which can be attacked. | ||||
// This should be called whenever our ownership changes. | // This should be called whenever our ownership changes. | ||||
BuildingAI.prototype.SetupGaiaRangeQuery = function() | BuildingAI.prototype.SetupGaiaRangeQuery = function() | ||||
{ | { | ||||
Show All 11 Lines | BuildingAI.prototype.SetupGaiaRangeQuery = function() | ||||
var cmpPlayer = QueryOwnerInterface(this.entity); | var cmpPlayer = QueryOwnerInterface(this.entity); | ||||
if (!cmpPlayer || !cmpPlayer.IsEnemy(0)) | if (!cmpPlayer || !cmpPlayer.IsEnemy(0)) | ||||
return; | return; | ||||
var range = cmpAttack.GetRange(attackType); | var range = cmpAttack.GetRange(attackType); | ||||
// This query is only interested in Gaia entities that can attack. | // This query is only interested in Gaia entities that can attack. | ||||
this.gaiaUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery( | this.gaiaUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery( | ||||
this.entity, range.min, range.max, range.elevationBonus, | this.entity, range.min, range.max, range.elevationBonus, | ||||
Lint: ESLintBear (indent): `Expected indentation of 2 tabs but found 3.` | |||||
[0], IID_Attack, cmpRangeManager.GetEntityFlagMask("normal")); | [0], IID_Attack, cmpRangeManager.GetEntityFlagMask("normal")); | ||||
Lint: ESLintBear (indent) Expected indentation of 2 tabs but found 3. Lint: ESLintBear (indent): `Expected indentation of 2 tabs but found 3.` | |||||
cmpRangeManager.EnableActiveQuery(this.gaiaUnitsQuery); | cmpRangeManager.EnableActiveQuery(this.gaiaUnitsQuery); | ||||
}; | }; | ||||
/** | /** | ||||
* Called when units enter or leave range | * Called when units enter or leave range | ||||
*/ | */ | ||||
BuildingAI.prototype.OnRangeUpdate = function(msg) | BuildingAI.prototype.OnRangeUpdate = function(msg) | ||||
▲ Show 20 Lines • Show All 208 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Expected indentation of 2 tabs but found 3.