Module:Crafting

From Official Gamemode 4 Wiki
Revision as of 21:04, 20 November 2018 by Kroppeb (talk | contribs) (ugh)
Jump to navigation Jump to search
p = {}

function Grid(args, w, h, large)
	return require([[Module:InventorySlot]]).Call(args,w,h,large)
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, args.Large)
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]))
		:SetSize(16)
		:GenerateHTML()
		:addClass( "catalyst" )
end

return p