Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/BuildingAI.js
Show First 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | msg.added = msg.added.filter(e => { | ||||||||
return cmpUnitAI && (!cmpUnitAI.IsAnimal() || cmpUnitAI.IsDangerousAnimal()); | return cmpUnitAI && (!cmpUnitAI.IsAnimal() || cmpUnitAI.IsDangerousAnimal()); | ||||||||
}); | }); | ||||||||
} | } | ||||||||
else if (msg.tag != this.enemyUnitsQuery) | else if (msg.tag != this.enemyUnitsQuery) | ||||||||
return; | return; | ||||||||
// Add new targets. | // Add new targets. | ||||||||
for (let entity of msg.added) | for (let entity of msg.added) | ||||||||
{ | |||||||||
if (Engine.QueryInterface(entity, IID_Camouflaged)) | |||||||||
continue; | |||||||||
SilierUnsubmitted Done Inline Actions
Silier: | |||||||||
if (cmpAttack.CanAttack(entity)) | if (cmpAttack.CanAttack(entity)) | ||||||||
this.targetUnits.push(entity); | this.targetUnits.push(entity); | ||||||||
} | |||||||||
Done Inline Actionsmove { to under for Silier: move { to under `for` | |||||||||
// Remove targets outside of vision-range. | // Remove targets outside of vision-range. | ||||||||
for (let entity of msg.removed) | for (let entity of msg.removed) | ||||||||
{ | { | ||||||||
let index = this.targetUnits.indexOf(entity); | let index = this.targetUnits.indexOf(entity); | ||||||||
Done Inline Actionsmerge conditions Silier: merge conditions | |||||||||
if (index > -1) | if (index > -1) | ||||||||
this.targetUnits.splice(index, 1); | this.targetUnits.splice(index, 1); | ||||||||
} | } | ||||||||
if (this.targetUnits.length) | if (this.targetUnits.length) | ||||||||
this.StartTimer(); | this.StartTimer(); | ||||||||
}; | }; | ||||||||
▲ Show 20 Lines • Show All 190 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator