Anonymous

Module:Sandbox/GauTest/Township: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 362: Line 362:
-- Upgrades To
-- Upgrades To
local upgradesTo = GameData.getEntityByProperty(Township.buildings, 'upgradesFrom', building.id)
local function checkFunc(entity)
if upgradesTo ~= nil then
return entity.upgradesFrom ~= nil and entity.upgradesFrom == building.id
table.insert(ret, '\r\n|-\r\n| <b>Upgrades To:</b> '..Icons.Icon({upgradesTo.name, type='building'}))
end
local upgradesTo = GameData.getEntities(Township.buildings, checkFunc)
if #upgradesTo > 0 then
table.insert(ret, '\r\n|-\r\n| <b>Upgrades To:</b> '..Icons.Icon({upgradesTo[1].name, type='building'}))
-- Cost
-- Cost
local upgrade_cost = {}
local upgrade_cost = {}
for _, resource in ipairs(upgradesTo.cost) do
for _, resource in ipairs(upgradesTo[1].cost) do
table.insert(upgrade_cost, Icons.Icon(p._GetResourceIcon(resource.id))..' '..resource.quantity)
table.insert(upgrade_cost, Icons.Icon(p._GetResourceIcon(resource.id))..' '..resource.quantity)
end
end
572

edits