Module:Township: Difference between revisions

Fix function
(Refer to actual data module)
(Fix function)
Line 373: Line 373:


-- Production
-- Production
local production = p._GetBuildingBaseProduction(building)
--local production = p._GetBuildingBaseProduction(building)
if production ~= nil then
--if production ~= nil then
table.insert(ret, '\r\n|-\r\n| <b>Base Production per '..Icons.Icon({'Workers', type='township', notext=true})..':</b><br>')
--table.insert(ret, '\r\n|-\r\n| <b>Base Production per '..Icons.Icon({'Workers', type='township', notext=true})..':</b><br>')
table.insert(ret, production)
--table.insert(ret, production)
end
--end


-- Modifiers
-- Modifiers
Line 415: Line 415:
for _, resource in ipairs(production) do
for _, resource in ipairs(production) do
local retProduction = {}
local retProduction = {}
local job = p._GetJobFromResource(resource.id)
-- TODO Fix always using first biome
local workers = GameData.getEntityByID(building.provides[1].workers, job).quantity
-- Sourced from township.js -> Township.computeTownResourceGain()
-- Sourced from township.js -> Township.computeTownResourceGain()
local production = resource.quantity*100*(Township.tickLength/10)
local production = resource.quantity*100*(Township.tickLength/10)
Line 430: Line 427:
end
end
end
end
retProduction = table.concat(retProduction, ', ')..'/t ('..Icons.Icon({'Workers', type='township', notext=true})..'&nbsp;'..workers..')'
table.insert(retResources, retProduction)
end
end
return table.concat(retResources, '<br>')
return table.concat(retResources, '<br>')
Line 596: Line 591:
end
end
BuildOptionalRow('\r\n|-\r\n! Benefits\r\n|', p._GetBuildingBenefits)
BuildOptionalRow('\r\n|-\r\n! Benefits\r\n|', p._GetBuildingBenefits)
BuildOptionalRow('\r\n|-\r\n! Base Production per '..Icons.Icon({'Workers', type='township', notext=true})..'\r\n|', p._GetBuildingBaseProduction)
BuildOptionalRow('\r\n|-\r\n! Biome Production Modifiers\r\n|', p._GetBiomeModifiers)
BuildOptionalRow('\r\n|-\r\n! Biome Production Modifiers\r\n|', p._GetBiomeModifiers)