缺氧 wiki 编辑团队提示:注册账号并登录后体验更佳,且可通过参数设置定制优化您的浏览体验!

该站点为镜像站点,如果你想帮助这个由玩家志愿编辑的 wiki 站点,请前往原站点参与编辑,
同时欢迎加入编辑讨论群 851803695 与其他编辑者一起参与建设!

全站通知:

模块:信息框/流星

来自缺氧WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

此模块的文档可以在模块:信息框/流星/doc创建

local infobox = require([[Module:信息框]])
local fstr = mw.ustring.format
local p = {}

local innerNodes = {
    {
        tag = 'image',
        source = '图片',
        children = {
            {
                tag = 'caption',
                source = '图片说明'
            }
        }
    },
    {
        tag = 'data',
        source = 'ID',
        label = 'ID'
    },
    {
        tag = 'data',
        source = '受难度影响',
        label = '受难度影响'
    },
    {
        tag = 'data',
        source = '击落战利品',
        label = '击落战利品'
    },
    {
        tag = 'data',
        source = '陨石坑生成物',
        label = '陨石坑生成物'
    },
    {
        tag = 'group',
        header = '成分',
        attr = {collapse = 'open'},
        children = {
            {
                tag = 'data',
                source = '主要成分',
                label = '主要成分'
            },
            {
                tag = 'data',
                source = '质量范围',
                label = '质量'
            },
            {
                tag = 'data',
                source = '温度范围',
                label = '温度'
            },
            {
                tag = 'data',
                source = '尾焰元素',
                label = '尾焰释放[[元素]]'
            },
            {
                tag = 'data',
                source = '尾焰释放速率',
                label = '尾焰释放速率'
            }
        }
    },
    {
        tag = 'group',
        header = '结块效果',
        attr = {collapse = 'open'},
        children = {
            {
                tag = 'data',
                source = '结块数量',
                label = '结块数量'
            },
            {
                tag = 'data',
                source = '结块高度',
                label = '结块高度'
            },
            {
                tag = 'data',
                source = '结块病菌',
                label = '结块病菌'
            }
        }
    },
    {
        tag = 'group',
        header = '伤害',
        attr = {collapse = 'open'},
        children = {
            {
                tag = 'data',
                source = '实体伤害',
                label = '实体伤害'
            },
            {
                tag = 'data',
                source = '实体砖伤害加成',
                label = '实体砖伤害加成'
            },
            {
                tag = 'data',
                source = '使复制人受伤',
                label = '使复制人受伤'
            }
        }
    },
    {
        tag = 'group',
        header = '爆炸效果',
        attr = {collapse = 'open'},
        children = {
            {
                tag = 'data',
                source = '爆炸速度',
                label = '爆炸速度'
            },
            {
                tag = 'data',
                source = '爆炸温度',
                label = '爆炸温度'
            },
            {
                tag = 'data',
                source = '溅射范围',
                label = '溅射范围'
            },
            {
                tag = 'data',
                source = '爆炸后销毁',
                label = '爆炸后销毁'
            },
        }
    },
    {
        tag = 'group',
        header = '生成',
        attr = {collapse = 'closed'},
        children = {
            {
                tag = 'data',
                source = '流速',
                label = '流速'
            },
            {
                tag = 'data',
                source = '掉落角度',
                label = '掉落角度'
            }
        }
    },
}

-- test: = p.infoboxContent{['持续时间'] = 900}
function p.infoboxContent(args)
    local generated = {}
    for _, n in ipairs(innerNodes) do
        local child = infobox.genNode(n, args)
        if child ~= nil then
            table.insert(generated, child)
        end
    end
    return generated
end

function p.main(title, data, raw)
    local contentNodes = nil
    if #data == 1 then
        contentNodes = p.infoboxContent(data[1].data)
    else
        local panelData = {}
        for _, pData in ipairs(data) do
            table.insert(panelData, {
                label = pData.label,
                content = p.infoboxContent(pData.data)
            })
        end
        contentNodes = {
            infobox.panel(panelData)
        }
    end
    return infobox.infobox(title, contentNodes, raw, 'Comet')
end

function p.demo(frame)
    local getArgs = require('Module:Dev/Arguments').getArgs
    local args = getArgs(frame)
    return p.main(args['标题'], {
        {
            data = args
        }
    }, args.raw)
end

return p