Differential D3456 Diff 15650 ps/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/BuildingAI.js
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | BuildingAI.prototype.SetupRangeQuery = function() | ||||
// Remove gaia. | // Remove gaia. | ||||
if (enemies.length && enemies[0] == 0) | if (enemies.length && enemies[0] == 0) | ||||
enemies.shift(); | enemies.shift(); | ||||
if (!enemies.length) | if (!enemies.length) | ||||
return; | return; | ||||
var range = cmpAttack.GetRange(attackType); | var range = cmpAttack.GetRange(attackType); | ||||
// This takes entity sizes into accounts, so no need to compensate for structure size. | |||||
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_Resistance, 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. | ||||
Show All 13 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 takes entity sizes into accounts, so no need to compensate for structure size. | |||||
this.gaiaUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery( | this.gaiaUnitsQuery = cmpRangeManager.CreateActiveParabolicQuery( | ||||
this.entity, range.min, range.max, range.elevationBonus, | this.entity, range.min, range.max, range.elevationBonus, | ||||
[0], IID_Attack, cmpRangeManager.GetEntityFlagMask("normal")); | [0], IID_Attack, cmpRangeManager.GetEntityFlagMask("normal")); | ||||
cmpRangeManager.EnableActiveQuery(this.gaiaUnitsQuery); | cmpRangeManager.EnableActiveQuery(this.gaiaUnitsQuery); | ||||
}; | }; | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 228 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator