本站文本内容除另有声明外,转载时均必须注明出处,并遵守CC BY-NC-SA 3.0协议。(转载须知
本站是中文Minecraft Wiki的镜像站,与Mojang Studios、Weird Gloop没有从属关系。(免责声明

全站通知:

模块:Block value

来自我的世界地下城WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

本模块用于实现{{hardness values}}{{blast resistance values}}

依赖项

local p = {}
local catMap = {
	['blast resistance'] = '爆炸抗性',
	hardness = '硬度'
}

function p.value( f )
	local args = f
	if f == mw.getCurrentFrame() then 
		args = require( 'Module:ProcessArgs' ).merge( true )
	end
	local block = mw.text.trim( args[1] or '' ):lower()
	local argType = args.type
	
	local values = mw.loadData( 'Module:' .. argType .. ' values' )
	local value = values[block]
	local category = ''
	if not value then
		value = values[block:gsub( 's$', '' )]
		
		if not value then
			value = '[[Template:' .. argType .. ' values#缺失值|?]]'
			local title = mw.title.getCurrentTitle()
			if not args.nocat and title.namespace == 0 and not title.isSubpage then
				category = '[[Category:缺失' .. ( catMap[argType:lower()] or argType:lower() ) .. ']]'
			end
		end
	end
	return value .. category
end

return p