Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/petra/headquarters.js
Show First 20 Lines • Show All 2,099 Lines • ▼ Show 20 Lines | for (let base of this.baseManagers) | ||||
nearestAnchor = base.anchor; | nearestAnchor = base.anchor; | ||||
} | } | ||||
} | } | ||||
if (!nearestAnchor || distmin > distcut) | if (!nearestAnchor || distmin > distcut) | ||||
return false; | return false; | ||||
// We will choose randomly ranged and melee units, except when garrisonHolder is full | // We will choose randomly ranged and melee units, except when garrisonHolder is full | ||||
// in which case we prefer melee units | // in which case we prefer melee units | ||||
let numGarrisoned = this.garrisonManager.numberOfGarrisonedUnits(nearestAnchor); | let numGarrisoned = this.garrisonManager.numberOfGarrisonedSlots(nearestAnchor); | ||||
if (nearestAnchor._entity.trainingQueue) | if (nearestAnchor._entity.trainingQueue) | ||||
{ | { | ||||
for (let item of nearestAnchor._entity.trainingQueue) | for (let item of nearestAnchor._entity.trainingQueue) | ||||
{ | { | ||||
if (item.metadata && item.metadata.garrisonType) | if (item.metadata && item.metadata.garrisonType) | ||||
numGarrisoned += item.count; | numGarrisoned += item.count; | ||||
else if (!item.progress && (!item.metadata || !item.metadata.trainer)) | else if (!item.progress && (!item.metadata || !item.metadata.trainer)) | ||||
nearestAnchor.stopProduction(item.id); | nearestAnchor.stopProduction(item.id); | ||||
▲ Show 20 Lines • Show All 780 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator