Module:Sandbox/GauTest/Township: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 506: Line 506:
-- Gets text for only the biomes that have a modifier for a building
-- Gets text for only the biomes that have a modifier for a building
function p._GetBiomeModifiers(building)
function p._GetBiomeModifiers(building)
if #building.biomeModifiers == 0 then
return nil
end
local biomeRet = {}
local biomeRet = {}
table.insert(biomeRet, '<ul>')
for _, biome in ipairs(building.biomeModifiers) do
for _, biome in ipairs(building.biomeModifiers) do
local biomename = GameData.getEntityByID(Township.biomes, biome.biomeID).name
local biomename = GameData.getEntityByID(Township.biomes, biome.biomeID).name
Line 518: Line 513:
table.insert(biomeRet, '<li style="color:'..color..'">'..biomename..' ('..biome_value..'%)</li>')
table.insert(biomeRet, '<li style="color:'..color..'">'..biomename..' ('..biome_value..'%)</li>')
end
end
table.insert(biomeRet, '</ul>')
if #biomeRet == 0 then
return table.concat(biomeRet)
return nil
end
return table.concat('<ul>'..biomeRet..'</ul>')
end
end


572

edits