Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/session/unit_commands.js
Show First 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | |||||
// Get all of the available entities which can be trained by the selected entities | // Get all of the available entities which can be trained by the selected entities | ||||
function getAllTrainableEntities(selection) | function getAllTrainableEntities(selection) | ||||
{ | { | ||||
let trainableEnts = []; | let trainableEnts = []; | ||||
// Get all buildable and trainable entities | // Get all buildable and trainable entities | ||||
for (let ent of selection) | for (let ent of selection) | ||||
{ | { | ||||
let state = GetEntityState(ent); | let state = GetEntityState(ent); | ||||
if (state && state.production && state.production.entities.length) | if (state?.trainer?.entities?.length) | ||||
trainableEnts = trainableEnts.concat(state.production.entities); | trainableEnts = trainableEnts.concat(state.trainer.entities); | ||||
} | } | ||||
// Remove duplicates | // Remove duplicates | ||||
removeDupes(trainableEnts); | removeDupes(trainableEnts); | ||||
return trainableEnts; | return trainableEnts; | ||||
} | } | ||||
function getAllTrainableEntitiesFromSelection() | function getAllTrainableEntitiesFromSelection() | ||||
Show All 31 Lines |
Wildfire Games · Phabricator