Index: ps/trunk/binaries/data/mods/public/globalscripts/Templates.js =================================================================== --- ps/trunk/binaries/data/mods/public/globalscripts/Templates.js +++ ps/trunk/binaries/data/mods/public/globalscripts/Templates.js @@ -368,8 +368,9 @@ let upgrade = template.Upgrade[upgradeName]; let cost = {}; - for (let res in upgrade.Cost) - cost[res] = getEntityValue("Upgrade/" + upgradeName + "/Cost/" + res, "Upgrade/Cost/" + res); + if (upgrade.Cost) + for (let res in upgrade.Cost) + cost[res] = getEntityValue("Upgrade/" + upgradeName + "/Cost/" + res, "Upgrade/Cost/" + res); if (upgrade.Time) cost.time = getEntityValue("Upgrade/" + upgradeName + "/Time", "Upgrade/Time"); Index: ps/trunk/binaries/data/mods/public/gui/structree/draw.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/structree/draw.js +++ ps/trunk/binaries/data/mods/public/gui/structree/draw.js @@ -207,7 +207,7 @@ if (trainer.upgrades) for (let upgrade of trainer.upgrades) { - if (!drawProdIcon(null, t, null, p, upgrade.data)) + if (!drawProdIcon(null, t, null, p, upgrade)) break; ++p; } Index: ps/trunk/binaries/data/mods/public/gui/structree/structree.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/structree/structree.js +++ ps/trunk/binaries/data/mods/public/gui/structree/structree.js @@ -265,16 +265,19 @@ } for (let unitCode of g_Lists.units) - if (g_ParsedData.units[unitCode] && ( - g_ParsedData.units[unitCode].production && Object.keys(g_ParsedData.units[unitCode].production).length - || g_ParsedData.units[unitCode].upgrades)) + if (g_ParsedData.units[unitCode]) { + let unitTemplate = g_ParsedData.units[unitCode]; + + if ((!unitTemplate.production || !Object.keys(unitTemplate.production).length) && !unitTemplate.upgrades) + continue; + // Replace any pair techs with the actual techs of that pair - if (g_ParsedData.units[unitCode].production.techs) - for (let prod of g_ParsedData.units[unitCode].production.techs) + if (unitTemplate.production && unitTemplate.production.techs) + for (let prod of unitTemplate.production.techs) if (prod in techPairs) - g_ParsedData.units[unitCode].production.techs.splice( - g_ParsedData.units[unitCode].production.techs.indexOf(prod), + unitTemplate.production.techs.splice( + unitTemplate.production.techs.indexOf(prod), 1, ...techPairs[prod].techs );