Module:表格/通用建造材料属性

来自缺氧 Wiki
跳转到导航 跳转到搜索

可在Module:表格/通用建造材料属性/doc创建此模块的帮助文档

-- Module:表格
local p = {}
local fstr = mw.ustring.format -- shortcut for formattig a string
local getArgs = require('Dev:Arguments').getArgs
local tb = 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(frame)
    local args = getArgs(frame)
    local out = {}
    for k, el in pairs(elData) do
        if el.state == "Solid" and not el.isDisabled then
            for _, t in ipairs(el.tags or {}) do
                if t == "BuildableAny" then
                    local dlcIcon = ""
                    if el.dlcId == "EXPANSION1_ID" then
                        dlcIcon = "{{眼冒金星图标}}"
                    end
                    table.insert(out, {
                        fstr("{{物品|%s}} %s", po(el.localizationID), dlcIcon),
                        fstr("%.3f", el.specificHeatCapacity),
                        fstr("%.3f", el.thermalConductivity),
                        fstr("%.2f", el.highTemp + utils.K0)
                    })
                    break
                end
            end
        end
    end
    return tb.table(out, args)
end

return p