Minecraft Wiki
Регистрация
Advertisement
[создать | история | обновить]Документация
У этого модуля нет документации. Если вы знаете, как использовать этот модуль, пожалуйста, добавьте соответствующую информацию.
local p = {}

p.begin = function(args)
	return "<div style=\"float:"
		.. (args.float or "none")
		.. "; left:0; top:0; width:"
		.. args[1]
		.. "px; height:"
		.. args[2]
		.. "px; position:relative; padding:0"
		.. (args.style or "")
		.. "\" class=\"gui CraftingGrid "
		.. (args.class or "")
		.. "\">"
end

p.footer = function()
	return "</div>"
end

p.div = function(args)
	local content = args[1]
	if content then
		return "<div style=\"left: "
		.. args[2]
		.. "px; top:"
		.. args[3]
		.. "px; width:32px; height:32px; position:absolute;"
		.. (args.style or "")
		.. "\" class="
		.. (args.class or "")
		.. " gridItemContainer CraftingGridCell\">"
		.. content
		.. "</div>"
	else
		return "<div></div>"
	end
end

p.slot = function(args)
	local content = args[1]
	if content then
		return "<div style=\"left: "
		.. args[2]
		.. "px; top:"
		.. args[3]
		.. "px; width:32px; height:32px; position:absolute;"
		.. (args.style or "")
		.. "\" class="
		.. (args.class or "")
		.. " gridItemContainer CraftingGridCell\">"
		.. require("Модуль:Инвентарный слот").slot({
			content,
			["класс"] = (args.class2 or ""),
			["мод"] = (args.mod or ""),
			["назв"] = args.title,
			["ссылка"] = args.link
		})
		.. "</div>"
	else
		return "<div></div>"
	end
end

p.liquidSlot = function(args)
	local content = args[1]
	if content then
		return "<div style=\"left: "
		.. args[2]
		.. "px; top:"
		.. args[3]
		.. "px; width:32px; height:32px; position:absolute;"
		.. (args.style or "")
		.. "\" class="
		.. (args.class or "")
		.. " gridTankContainer CraftingGridCell\">"
		.. require("Модуль:Жидкостный слот").slot({
			content,
			["объём"] = tonumber(args.volume or "0"),
			["фон"] = args.background or "",
			["стиль"] = args.style or ""
		})
		.. "</div>"
	else
		return "<div></div>"
	end
end

p.text = function(args)
	return "<div style=\"left: "
	.. args[2]
	.. "px; top:"
	.. args[3]
	.. "px; position:absolute; display:inline-block;"
	.. (args.style or "")
	.. "\" class="
	.. (args.class or "")
	.. " gridTextContainer CraftingGridCell\">"
	.. args[1]
	.. "</div>"
end

p.shapeless = function(args)
	return "<span style=\"left: "
	.. args[2]
	.. "px; top:"
	.. args[3]
	.. "px; position:absolute; cursor:help;"
	.. (args.style or "")
	.. "\" class="
	.. (args.class or "")
	.. "\" title=\"Этот рецепт бесформенный, ингредиенты могут быть размещены в сетку крафта любым способом.\"></span>"
end

p.image = function(args)
	return "<div style=\"left: "
	.. args[2]
	.. "px; top:"
	.. args[3]
	.. "px; position:absolute; display:inline-block;"
	.. (args.style or "")
	.. "\" class="
	.. (args.class or "")
	.. " gridImageContainer CraftingGridCell\">"
	.. args[1]
	.. "</div>"
end

p.backgroundImage = function(args)
	local sizeSpecifier = ""
	local width = args[2]
	if width then
		sizeSpecifier = "|" .. width .. "px"
	end
	
	return "<div style=\"position:absolute;\">[[File:"
	.. args[1]
	.. sizeSpecifier
	.. "|link=|alt=]]</div>"
end

p.progress = function(args)
	local isReverse = args.reverse
	local progressClass = "progress"
	if isReverse then
		progressClass = "progress-reverse"
	end
	local dir = args.dir or "up"
	local dirs = {up = 1, right = 2, down = 3, left = 4}
	local knownDir = dirs[dir]
	local clip = {"auto", "auto", "auto", "auto"}
	if dir and knownDir then
		clip[knownDir] = args.size or "0"
	end
	local clipData = table.concat(clip, " ")
	
	return "<div style=\"position:absolute;\" class=\""
	.. progressClass
	.. "\" style=\"animation-name:progress-"
	.. dir
	.. "; left:"
	.. args[2]
	.. "px; top:"
	.. args[3]
	.. "px; position:absolute; display:inline-block; clip: rect("
	.. clipData
	.. ");\">[[File:"
	.. args[1]
	.. "|link=|alt=]]</div>"
end

p.machine = function(args)
	local dir = args.dir or "up"
	local dirs = {up = 1, right = 2, down = 3, left = 4}
	local knownDir = dirs[dir]
	local clip = {"auto", "auto", "auto", "auto"}
	if dir and knownDir then
		clip[knownDir] = args.size or "0"
	end
	local clipData = table.concat(clip, " ")
	
	return "<div style=\"position:absolute;\" class=\"invslot-item\" data-minetip-title=\""
	.. (args.text or "")
	.. "\" data-minetip-text=\""
	.. (args.text2 or "")
	.. "\" style=\"animation-name:progress-"
	.. dir
	.. "; left:"
	.. args[2]
	.. "px; top:"
	.. args[3]
	.. "px; position:absolute; display:inline-block; clip: rect("
	.. clipData
	.. ");\">[[File:"
	.. args[1]
	.. "|link="
	.. (args.link or "")
	.. "|alt=]]</div>"
end

return p
Advertisement