缺氧 wiki 编辑团队提示:注册账号并登录后体验更佳,且可通过参数设置定制优化您的浏览体验!
该站点为镜像站点,如果你想帮助这个由玩家志愿编辑的 wiki 站点,请前往原站点参与编辑,
同时欢迎加入编辑讨论群 851803695 与其他编辑者一起参与建设!
全站通知:
模块:信息框/病菌
刷
历
编
< 模块:信息框
跳到导航
跳到搜索
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 = 'group',
header = '致病信息',
attr = {collapse = 'open'},
children = {
{
tag = 'data',
source = '感染疾病',
label = '<abbr title = "因接触这个病菌,复制人感染的疾病">感染疾病</abbr>'
},
{
tag = 'data',
source = '立刻染病',
label = '<abbr title = "接触这个病菌后,复制人将立刻感染疾病">立刻染病</abbr>'
},
{
tag = 'data',
source = '暴露阈值',
label = '<abbr title = "在与该病菌接触达到阈值后将感染疾病">暴露阈值</abbr>'
},
{
tag = 'data',
source = '抗菌特质',
label = '<abbr title = "拥有这些特质的复制人,将不容易得病">可抗菌的特质</abbr>'
},
{
tag = 'data',
source = '抗菌效果',
label = '<abbr title = "获得这些效果加成的复制人,将不容易得病">可抗菌的效果</abbr>'
}
}
},
{
tag = 'group',
header = '温度因素影响',
attr = {collapse = 'open'},
children = {
{
tag = 'data',
source = '存活温度范围',
label = '<abbr title = "温度范围下存活">存活温度范围</abbr>'
},
{
tag = 'data',
source = '繁殖温度范围',
label = '<abbr title = "温度范围有利于它们的繁殖">繁殖温度范围</abbr>'
},
{
tag = 'data',
source = '低温半衰期',
label = '<abbr title = "在存活温度范围的低温段,病菌数量减半的时间">低温半衰期</abbr>'
},
{
tag = 'data',
source = '高温半衰期',
label = '<abbr title = "在存活温度范围的高温段,病菌数量减半的时间">高温半衰期</abbr>'
}
}
},
{
tag = 'group',
header = '生存环境因素影响',
attr = {collapse = 'open'},
children = {
{
tag = 'data',
source = '繁殖于',
label = '<abbr title = "这些物质能促进病菌的传播和繁殖">繁殖于</abbr>'
},
{
tag = 'data',
source = '存活于',
label = '<abbr title = "病菌在接触这些物质时能继续存活,但是不会繁殖">存活于</abbr>'
},
{
tag = 'data',
source = '抑菌物',
label = '<abbr title = "接触这些物质能缓慢地减少病菌数量">抑菌物</abbr>'
},
{
tag = 'data',
source = '抗菌物',
label = '<abbr title = "接触这些物质能逐渐杀死病菌">抗菌物</abbr>'
},
{
tag = 'data',
source = '灭菌物',
label = '<abbr title = "接触这些物质能快速杀死病菌">灭菌物</abbr>'
}
}
},
}
-- test: = p.infoboxContent{['辐射杀菌系数'] = 2, ['导致疾病'] = ""}
function p.infoboxContent(args)
if args['存活温度下限'] ~= nil and args['存活温度上限'] ~= nil then
args['存活温度范围'] = fstr("%s ↔ %s",
args['存活温度下限'] == "Infinity" and "∞" or args['存活温度下限'],
args['存活温度上限'] == "Infinity" and "∞" or args['存活温度上限']
)
end
if args['繁殖温度下限'] ~= nil and args['繁殖温度上限'] then
args['繁殖温度范围'] = fstr("%s ↔ %s",
args['繁殖温度下限'] == "Infinity" and "∞" or args['繁殖温度下限'],
args['繁殖温度上限'] == "Infinity" and "∞" or args['繁殖温度上限']
)
end
if args['存活温度半衰期下限'] ~= nil and args['繁殖温度半衰期下限'] then
args['低温半衰期'] = fstr("%s ↔ %s",
args['存活温度半衰期下限'] == "Infinity" and "∞" or args['存活温度半衰期下限'],
args['繁殖温度半衰期下限'] == "Infinity" and "∞" or args['繁殖温度半衰期下限']
)
end
if args['繁殖温度半衰期上限'] ~= nil and args['存活温度半衰期上限'] then
args['高温半衰期'] = fstr("%s ↔ %s",
args['繁殖温度半衰期上限'] == "Infinity" and "∞" or args['繁殖温度半衰期上限'],
args['存活温度半衰期上限'] == "Infinity" and "∞" or args['存活温度半衰期上限']
)
end
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, 'disease')
end
function p.demo(frame)
local getArgs = require('Dev:Arguments').getArgs
local args = getArgs(frame)
return p.main(args['标题'], {
{
data = args
}
}, args.raw)
end
return p