Anonymous

Module:Township: Difference between revisions

From Melvor Idle
Tavern/Gardens production fix
No edit summary
(Tavern/Gardens production fix)
Line 426: Line 426:
-- 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)
local color = production < 0 and 'red' or 'green'
local resource_data = p._GetResourceByID(resource.id)
local resource_data = p._GetResourceByID(resource.id)
table.insert(retProduction, '<span style="color:green">'..Icons.Icon({resource_data.name, type='resource', notext=true})..'&nbsp;+'..production..'</span>')
table.insert(retProduction, '<span style="color:'..color..'">'..Icons.Icon({resource_data.name, type='resource', notext=true})..'&nbsp;'..Shared.numStrWithSign(production)..'</span>')
if resource_data.requires ~= nil and #resource_data.requires > 0 then
if resource_data.requires ~= nil and #resource_data.requires > 0 then
for _, required_resource in ipairs(resource_data.requires) do
for _, required_resource in ipairs(resource_data.requires) do
572

edits