--Digs a row, as well as the row beneath it. --Length is the length of the row to dig function digRow( length, doubleRow ) for i = 1, length do -- Check if we want a Double row -- Dig out the bottom of the row we are on if ( doubleRow and turtle.detectDown() ) then turtle.digDown() end -- If not on the last row, clear dig until we can move -- (Will move forward in the process) if ( i < length ) then while ( not turtle.forward() ) do turtle.dig() end end end end function digLevel( width, length, doubleRow ) for i = 1, width do digRow( length, doubleRow ) -- If we're on an odd row, we want to turn right if ( i < width and i % 2 == 1 ) then turtle.turnRight() while ( not turtle.forward() ) do turtle.dig( ) end turtle.turnRight( ) -- Else turn left elseif ( i < width ) then turtle.turnLeft() while ( not turtle.forward() ) do turtle.dig( ) end turtle.turnLeft( ) end end -- If ending on a far side if ( i % 2 == 1 ) then turtle.turnRight() turtle.turnRight() for x = 1, length do turtle.forward() end turtle.turnRight() end for y = 1, width do turtle.forward() end turtle.turnRight() end function checkInventory( ) end local args = { ... } -- Grab the arguments! local width = tonumber(args[ 1 ]) local heigh = tonumber(args[ 2 ]) local depth = tonumber(args[ 3 ]) for row = 1, depth/2 do digLevel( width, height, true ) -- Move down to the next room turtle.down() if ( turtle.detectDown() ) then turtle.digDown() end turtle.down() end if ( depth % 2 == 1 ) then digLevel( width, height, false ) end for row = 1, depth do while ( not turtle.up() ) do turtle.digUp() end end