Feed The Beast Wiki
Advertisement

Documentation for this module may be created at Module:Infusion/doc

local infuse = {}
--No I don't know [expletive] about Lua, but [expletive] it we'll do it live
function rotate(args, f)
	local function ring(number, offset)
		return "transform: rotate(" .. ((number or 0) * (offset or 0)) .. "deg) translate(80px) rotate(" .. ((-number or 0) * (offset or 0)) .. "deg);"
	end
	local num = 1
	local stuff = {}
	while args["I" .. num] ~= nil do
		table.insert(stuff, args["I" .. num])
		num = num + 1
	end
	local page = ""
	if #stuff > 0 then
		num = 360 / (num-1)
		for i, gc in ipairs(stuff) do
			page = page .. f:expandTemplate{title="Cg", args={"cell", gc, 162, 177, style=ring(num, i)}}
		end
	end
	return page
end

function space (args, f)
	local function line (number)
		return ((number or 0) * 34)
	end
	
	local num = 1
	local stuff = {}
	while args["A" .. num] ~= nil do
		table.insert(stuff, args["A" .. num])
		num = num + 1
	end
	local start = 159 - (num / 2)
	local page = ""
	if #stuff > 0 then
		for i, gc in ipairs(stuff) do
			page = page .. f:expandTemplate{title="Cg", args={"cell", gc, start + line(i), 300 }}
		end
	end
	return page
end

infuse.infusion = function(f)
	local args = f.args or f
	if f == mw.getCurrentFrame() then
		args = f:getParent().args
	else
		f = mw.getCurrentFrame()
	end
	
	return "<span>" .. f:expandTemplate{title="Cg", args={nil, 362, 340}} .. f:expandTemplate{title="Cg", args={"bg-image", "GUI Arcane Infusion.png"}} .. f:expandTemplate{title="Cg", args={"text", require("Module:Language").link({"Infusion Altar", --[[]]"Infusion Altar"--[[]]}), nil, nil, 0, 4, class="craftingGridText craftingGridLink craftingGridTitle"}} .. rotate(args, f) .. f:expandTemplate{title="Cg", args={"cell", args.C or "", 159, 177}} .. f:expandTemplate{title="Cg", args={"cell", args.O or "", 159, 42} .. space(args, f) .. "</div></span>"} 
end
return infuse
Advertisement