Module:Crafting: Difference between revisions

From Official Gamemode 4 Wiki
Jump to navigation Jump to search
(typo)
No edit summary
Line 32: Line 32:
end
end


function p.Arrow( f )
function p.Catalyst( f )
local args = f.args
local args = f.args
if #args == 0 then
if #args == 0 then
args = f:getParent().args
args = f:getParent().args or {""}
end
end
return require([[Module:Sprite]])
return require([[Module:Sprite]])
:new("crafting_arrow")
:new("inventory")
:setItem(mw.text.trim(args[1]))
:setItem(mw.text.trim(args[1]))
:GenerateHTML()
:GenerateHTML()

Revision as of 15:38, 10 November 2018

p = {}

function Grid(args, w, h)
	return require([[Module:InventorySlot]]).Call(args,w,h)
end

function p.Grid( f )
	local args = f.args
	if #args == 0 then
		args = f:getParent().args
	end

	return Grid(args, 3, 3)
end

function p.Cell( f )
	local args = f.args
	if #args == 0 then
		args = f:getParent().args
	end

	return Grid(args, 1, 1)
end

function p.Hopper( f )
	local args = f.args
	if #args == 0 then
		args = f:getParent().args
	end

	return Grid(args, 5, 1)
end

function p.Catalyst( f )
	local args = f.args
	if #args == 0 then
		args = f:getParent().args or {""}
	end
	return require([[Module:Sprite]])
		:new("inventory")
		:setItem(mw.text.trim(args[1]))
		:GenerateHTML()
end

return p