Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/reference/common/load.js
Show First 20 Lines • Show All 222 Lines • ▼ Show 20 Lines | if (structure.wallSet) | ||||
// For technology cost multiplier, we need to use the tower | // For technology cost multiplier, we need to use the tower | ||||
struct = loadStructure(structure.wallSet.templates.tower); | struct = loadStructure(structure.wallSet.templates.tower); | ||||
structure.techCostMultiplier = struct.techCostMultiplier; | structure.techCostMultiplier = struct.techCostMultiplier; | ||||
let health; | let health; | ||||
for (let wSegm in structure.wallSet.templates) | for (let wSegm in structure.wallSet.templates) | ||||
{ | { | ||||
if (wSegm == "fort" || wSegm == "curves") | |||||
continue; | |||||
let wPart = loadStructure(structure.wallSet.templates[wSegm]); | let wPart = loadStructure(structure.wallSet.templates[wSegm]); | ||||
structure.wallset[wSegm] = wPart; | structure.wallset[wSegm] = wPart; | ||||
for (let research of wPart.production.technology) | for (let research of wPart.production.technology) | ||||
structure.production.technology.push(research); | structure.production.technology.push(research); | ||||
if (wPart.upgrades) | if (wPart.upgrades) | ||||
structure.upgrades = structure.upgrades.concat(wPart.upgrades); | structure.upgrades = structure.upgrades.concat(wPart.upgrades); | ||||
if (["gate", "tower"].indexOf(wSegm) != -1) | if (["gate", "tower"].indexOf(wSegm) != -1) | ||||
continue; | continue; | ||||
if (!health) | if (!health) | ||||
{ | { | ||||
health = { "min": wPart.health, "max": wPart.health }; | health = { "min": wPart.health, "max": wPart.health }; | ||||
continue; | continue; | ||||
} | } | ||||
health.min = Math.min(health.min, wPart.health); | health.min = Math.min(health.min, wPart.health); | ||||
health.max = Math.max(health.max, wPart.health); | health.max = Math.max(health.max, wPart.health); | ||||
} | } | ||||
if (structure.wallSet.templates.curves) | |||||
for (let curve of structure.wallSet.templates.curves) | |||||
{ | |||||
let wPart = loadStructure(curve); | |||||
health.min = Math.min(health.min, wPart.health); | |||||
health.max = Math.max(health.max, wPart.health); | |||||
} | |||||
if (health.min == health.max) | if (health.min == health.max) | ||||
structure.health = health.min; | structure.health = health.min; | ||||
else | else | ||||
structure.health = sprintf(translate("%(health_min)s to %(health_max)s"), { | structure.health = sprintf(translate("%(health_min)s to %(health_max)s"), { | ||||
"health_min": health.min, | "health_min": health.min, | ||||
"health_max": health.max | "health_max": health.max | ||||
}); | }); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator