Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/tooltips.js
Show First 20 Lines • Show All 581 Lines • ▼ Show 20 Lines | for (let i = 0; i < wallTypes.length; ++i) | ||||
out.push(getEntityCostComponentsTooltipString(wallTypes[i]).join(", ")); | out.push(getEntityCostComponentsTooltipString(wallTypes[i]).join(", ")); | ||||
return out; | return out; | ||||
} | } | ||||
/** | /** | ||||
* Returns the cost information to display in the specified entity's construction button tooltip. | * Returns the cost information to display in the specified entity's construction button tooltip. | ||||
*/ | */ | ||||
function getEntityCostTooltip(template, entity, buildingsCountToTrainFullBatch, fullBatchSize, remainderBatch) | function getEntityCostTooltip(template, entity, buildingsCountToTrainFullBatch, fullBatchSize, remainderBatch, player) | ||||
{ | { | ||||
// Entities with a wallset component are proxies for initiating wall placement and as such do not have a cost of | // Entities with a wallset component are proxies for initiating wall placement and as such do not have a cost of | ||||
// their own; the individual wall pieces within it do. | // their own; the individual wall pieces within it do. | ||||
if (template.wallSet) | if (template.wallSet) | ||||
{ | { | ||||
let templateLong = GetTemplateData(template.wallSet.templates.long); | let templateLong = GetTemplateData(template.wallSet.templates.long, player); | ||||
let templateMedium = GetTemplateData(template.wallSet.templates.medium); | let templateMedium = GetTemplateData(template.wallSet.templates.medium, player); | ||||
let templateShort = GetTemplateData(template.wallSet.templates.short); | let templateShort = GetTemplateData(template.wallSet.templates.short, player); | ||||
let templateTower = GetTemplateData(template.wallSet.templates.tower); | let templateTower = GetTemplateData(template.wallSet.templates.tower, player); | ||||
let wallCosts = getWallPieceTooltip([templateShort, templateMedium, templateLong]); | let wallCosts = getWallPieceTooltip([templateShort, templateMedium, templateLong]); | ||||
let towerCosts = getEntityCostComponentsTooltipString(templateTower); | let towerCosts = getEntityCostComponentsTooltipString(templateTower); | ||||
return sprintf(translate("Walls: %(costs)s"), { "costs": wallCosts.join(" ") }) + "\n" + | return sprintf(translate("Walls: %(costs)s"), { "costs": wallCosts.join(" ") }) + "\n" + | ||||
sprintf(translate("Towers: %(costs)s"), { "costs": towerCosts.join(" ") }); | sprintf(translate("Towers: %(costs)s"), { "costs": towerCosts.join(" ") }); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 228 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator