Module:HabModuleSpecial: Difference between revisions
From Terra Invicta Official Wiki
No edit summary |
No edit summary |
||
| Line 16: | Line 16: | ||
if not hmsData[hmsName][3] then | if not hmsData[hmsName][3] then | ||
return hmsData[hmsName][1] | return hmsData[hmsName][1] | ||
elseif hmsData[hmsName][3] == 'tier' then | |||
return hmsData[hmsName][1] .. frame.args['tier'] .. hmsData[hmsName][2] | |||
elseif hmsData[hmsName][3] == 'specialRulesValue' then | elseif hmsData[hmsName][3] == 'specialRulesValue' then | ||
return hmsData[hmsName][1] .. frame.args['specialRulesValue'] .. hmsData[hmsName][2] | return hmsData[hmsName][1] .. frame.args['specialRulesValue'] .. hmsData[hmsName][2] | ||
Revision as of 03:40, 30 November 2025
Documentation for this module may be created at Module:HabModuleSpecial/doc
-- This is a LUA version of the Template:HabModuleSpecial page.
local p = {}
local IconModule = require('Module:Icon')
local hmsData = mw.loadData( 'Module:HabModuleSpecial/data' )
function p.hms( frame )
local hmsName = frame.args[1]
if not hmsName or not hmsData[hmsName] then
return 'No such Hab Module Special'
end
-- hmsData[hmsName][1] is the text before the value.
-- hmsData[hmsName][2] is the text after the value.
-- hmsData[hmsName][3] is the value type to insert.
if not hmsData[hmsName][3] then
return hmsData[hmsName][1]
elseif hmsData[hmsName][3] == 'tier' then
return hmsData[hmsName][1] .. frame.args['tier'] .. hmsData[hmsName][2]
elseif hmsData[hmsName][3] == 'specialRulesValue' then
return hmsData[hmsName][1] .. frame.args['specialRulesValue'] .. hmsData[hmsName][2]
elseif hmsData[hmsName][3] == 'specialRulesValue%' then
return hmsData[hmsName][1] .. tostring(tonumber(frame.args['specialRulesValue']) * 100) .. '%' .. hmsData[hmsName][2]
elseif hmsData[hmsName][3] == 'constructionTimeModifier' then
return hmsData[hmsName][1] .. frame.args['constructionTimeModifier'] .. hmsData[hmsName][2]
elseif hmsData[hmsName][3] == 'controlPointCapacity' then
return hmsData[hmsName][1] .. frame.args['controlPointCapacity'] .. hmsData[hmsName][2]
elseif hmsData[hmsName][3] == 'techBonus' then
local techBonus = tostring(tonumber(frame.args['techBonus']) * 100) .. '% '
local techCat = frame.args['techCat']
return hmsData[hmsName][1] .. techBonus .. IconModule.Icon({args={techCat}}) .. techCat .. hmsData[hmsName][2]
end
return 'ERROR, this should never appear.'
end
return p


