sx, sy, sz = GetInt("size", 100, 30, 100)
wall = GetString("type", "outerwall/brick.vox", "brush vox")
corner = GetString("corner", "", "brush vox")
outside = GetString("outside", "", "brush vox")
inside = GetString("inside", "", "brush vox")
outsideOffset = GetInt("outsideOffset", 1)
insideOffset = GetInt("insideOffset", 1)
ti, to = GetInt("thickness", 0 , 0)


function init()
	local cornerExtra = 1

	local wallMat = CreateBrush(wall)
	local _,_,thickness = GetBrushSize(wallMat)

	local cornerMat1
	local cornerMat2
	if corner ~= "" then
		cornerMat1 = CreateBrush(corner, true)
		cornerMat2 = CreateBrush(corner, true)
		FlipBrush(cornerMat2, "x")
	end

	local outsideMat
	local outsideThickness
	if outside ~= "" then
		outsideMat = CreateBrush(outside, true)
		local _,_,z = GetBrushSize(outsideMat)
		if ti == 0 then
			outsideThickness = z
		else
			outsideThickness = to
		end
	end

	local insideMat
	local insideThickness
	if inside ~= "" then
		insideMat = CreateBrush(inside, true)
		local _,_,z = GetBrushSize(insideMat)
		if to == 0 then
			insideThickness = z
		else
			insideThickness = ti
		end
	end

	local t = thickness
	local ct = thickness+cornerExtra

	local function createWall(l, corners)
		Material(wallMat)
		for i=0, thickness-1 do
			Box(i, 0, i, l-i, sy, i+1)
		end
		if outsideMat then
			Material(outsideMat)
			Box(0, 0, -outsideThickness+outsideOffset, l, sy, outsideOffset)
		end
		if insideMat then
			Material(insideMat)
			Box(thickness, 0, thickness-insideOffset, l-thickness, sy, thickness-insideOffset+insideThickness)
		end
		if cornerMat1 and cornerMat2 and corners then
			Material(cornerMat1)
			Box(-1, 0, -1, ct-1, sy, t)
			Material(cornerMat2)
			Box(l-ct+1, 0, -1, l+1, sy, t)
		end
	end

	Vox(0,0,0)
	createWall(sx, true)
	Vox(sx, 0, 0, 0, -90, 0)
	createWall(sz, false)
	Vox(sx, 0, sz, 0,180,0)
	createWall(sx, true)
	Vox(0,0,sz, 0, 90, 0)
	createWall(sz, false)
end

