606
edits
m |
m |
||
| Line 195: | Line 195: | ||
end | end | ||
--/ | --/ | ||
--SECTION-UNLOCKING | |||
if buildingData.influence then | if buildingData.influence then | ||
local unlockData = {} | |||
local first = true | |||
for resource, amount in pairs(buildingData.influence) do | |||
if resource ~= 'tier' then -- Exclude the 'tier' key | |||
local displayAmount = amount | |||
if first and buildingData.influence.tier then | |||
displayAmount = displayAmount .. ' ' .. buildingData.influence.tier | |||
first = false | |||
end | |||
local resourceIcon = i.icon(resource, nil, nil, com.firstUpper({resource}), 'en') | |||
local tierPosition = string.find(displayAmount, "tier", nil, true) | |||
if tierPosition then | |||
local beforeTier = string.sub(displayAmount, 1, tierPosition - 1) | |||
local theTier = string.sub(displayAmount, tierPosition) | |||
table.insert(unlockData, {label = resourceIcon, value = beforeTier .. "(" .. theTier .. ")"}) | |||
else | |||
table.insert(unlockData, {label = resourceIcon, value = displayAmount}) | |||
end | |||
end | end | ||
end | |||
if #unlockData > 0 then | |||
addSection(infobox, unlockData, 'Unlocking Conditions', 2) | |||
end | |||
end | |||
--/ | --/ | ||
---SECTION-CONSTRUCTION | ---SECTION-CONSTRUCTION | ||
edits