Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/unit_commands.js
// The number of currently visible buttons (used to optimise showing/hiding) | // The number of currently visible buttons (used to optimise showing/hiding) | ||||
var g_unitPanelButtons = { | var g_unitPanelButtons = { | ||||
"Selection": 0, | "Selection": 0, | ||||
"Queue": 0, | "Queue": 0, | ||||
"Formation": 0, | "Formation": 0, | ||||
"Garrison": 0, | "Garrison": 0, | ||||
"Training": 0, | "Training": 0, | ||||
"GroupTraining": 0, | |||||
"Research": 0, | "Research": 0, | ||||
"Alert": 0, | "Alert": 0, | ||||
"Barter": 0, | "Barter": 0, | ||||
"Construction": 0, | "Construction": 0, | ||||
"Command": 0, | "Command": 0, | ||||
"AllyCommand": 0, | "AllyCommand": 0, | ||||
"Stance": 0, | "Stance": 0, | ||||
"Gate": 0, | "Gate": 0, | ||||
▲ Show 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | |||||
function getAllTrainableEntitiesFromSelection() | function getAllTrainableEntitiesFromSelection() | ||||
{ | { | ||||
if (!g_allTrainableEntities) | if (!g_allTrainableEntities) | ||||
g_allTrainableEntities = getAllTrainableEntities(g_Selection.toList()); | g_allTrainableEntities = getAllTrainableEntities(g_Selection.toList()); | ||||
return g_allTrainableEntities; | return g_allTrainableEntities; | ||||
} | } | ||||
// Get all of the available entities which can be trained by the selected entities | |||||
function getAllTrainableGroups(selection) | |||||
{ | |||||
let trainableGroups = []; | |||||
// Get all buildable and trainable groups | |||||
for (let ent of selection) | |||||
{ | |||||
let state = GetEntityState(ent); | |||||
if (state && state.production && state.production.groups.length) | |||||
trainableGroups = trainableGroups.concat(state.production.groups); | |||||
} | |||||
// Remove duplicates | |||||
removeDupes(trainableGroups); | |||||
return trainableGroups; | |||||
} | |||||
function getAllTrainableGroupsFromSelection() | |||||
{ | |||||
if (!g_allTrainableGroups) | |||||
g_allTrainableGroups = getAllTrainableGroups(g_Selection.toList()); | |||||
return g_allTrainableGroups; | |||||
} | |||||
// Get all of the available entities which can be built by the selected entities | // Get all of the available entities which can be built by the selected entities | ||||
function getAllBuildableEntities(selection) | function getAllBuildableEntities(selection) | ||||
{ | { | ||||
return Engine.GuiInterfaceCall("GetAllBuildableEntities", { "entities": selection }); | return Engine.GuiInterfaceCall("GetAllBuildableEntities", { "entities": selection }); | ||||
} | } | ||||
function getAllBuildableEntitiesFromSelection() | function getAllBuildableEntitiesFromSelection() | ||||
{ | { | ||||
Show All 16 Lines |
Wildfire Games · Phabricator