缺氧 wiki 编辑团队提示:注册账号并登录后体验更佳,且可通过参数设置定制优化您的浏览体验!
该站点为镜像站点,如果你想帮助这个由玩家志愿编辑的 wiki 站点,请前往原站点参与编辑,
同时欢迎加入编辑讨论群 851803695 与其他编辑者一起参与建设!
全站通知:
模块:表格/液体
刷
历
编
< 模块:表格
跳到导航
跳到搜索
此模块的文档可以在模块:表格/液体/doc创建
-- Module:表格/液体
local p = {}
local fstr = mw.ustring.format -- shortcut for formattig a string
local getArgs = require('Module:Dev/Arguments').getArgs
local tb = require([[Module:表格]])
local eModule = require([[Module:元素信息框]])
local po = require([[Module:Po]]).po
local utils = require([[Module:Utils]])
local elData = mw.loadData([[Module:Data/Elements]])
-- test by: = p._main({})
function p._main(args)
local out = {}
local ids = {}
for _, ele in pairs(elData) do
if ele.state == "Liquid" then
if not utils.isDefaultT(ele.localizationID, po(ele.localizationID)) then
table.insert(ids, ele.elementId)
end
end
end
table.sort(ids, function(a, b) -- put disabled elements at back
if elData[a].isDisabled ~= elData[b].isDisabled then
return elData[b].isDisabled
end
return elData[a].molarMass < elData[b].molarMass
end)
for _, id in ipairs(ids) do
local ele = elData[id]
local elname = po(ele.localizationID)
local desc = po(ele.localizationID:gsub("NAME$", "DESC"))
local name = fstr('[[File:%s.png|24px|link=%s|%s]][[%s]]', elname, elname, desc, elname)
if ele.isDisabled then name = name .. "<wbr>(未实装)" end
if ele.dlcId == "EXPANSION1_ID" then
name = name .. " <wbr>{{眼冒金星图标}}"
end
local shc = utils.float2str(ele.specificHeatCapacity, 3)
local tc = ele.thermalConductivity
local lowTemp = utils.float2str(ele.lowTemp + utils.K0)
local lowTempTarget = ""
if ele.lowTempTransitionOreId then
local page1 = eModule.id2pageName(ele.lowTempTransitionTarget)
local page2 = eModule.id2pageName(ele.lowTempTransitionOreId)
local ratio2 = tonumber(ele.lowTempTransitionOreMassConversion)
local ratio1 = 1 - ratio2
lowTempTarget = fstr("[[%s]]:[[%s]] = <wbr>%.2f : %.2f", page1,
page2, ratio1, ratio2)
elseif ele.lowTempTransitionTarget ~= nil then
local page1 = eModule.id2pageName(ele.lowTempTransitionTarget)
lowTempTarget = fstr("[[%s]]", page1)
end
local highTemp = utils.float2str(ele.highTemp + utils.K0)
local highTempTarget = ""
if ele.highTempTransitionOreId then
local page1 = eModule.id2pageName(ele.highTempTransitionTarget)
local page2 = eModule.id2pageName(ele.highTempTransitionOreId)
local ratio2 = tonumber(ele.highTempTransitionOreMassConversion)
local ratio1 = 1 - ratio2
highTempTarget = fstr("[[%s]]:[[%s]] = <wbr>%.2f : %.2f", page1,
page2, ratio1, ratio2)
elseif ele.highTempTransitionTarget ~= nil then
local page1 = eModule.id2pageName(ele.highTempTransitionTarget)
highTempTarget = fstr("[[%s]]", page1)
end
local molarMass = ele.molarMass or ""
local radiationAbsorptionFactor = fstr('%.2f', tonumber(ele.radiationAbsorptionFactor) or 0)
table.insert(out,
{name, lowTemp, lowTempTarget,highTemp, highTempTarget, shc, tc, molarMass, radiationAbsorptionFactor})
end
return tb.table(out, args)
end
function p.main(frame) return p._main(getArgs(frame)) end
return p