Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- if #tArgs ~= 1 then
- print("Usage: Quarry <size>")
- end
- print("To Use: ")
- print("Place enderchest in slot 16.")
- print("Make sure the turtle has Fuel.")
- local size = tArgs[1]
- local depth = 0
- --Functions
- local function chest()
- if turtle.getItemCount(14) > 0 then
- turtle.digUp()
- turtle.select(16)
- turtle.placeUp()
- for i = 1,14 do
- turtle.select(i)
- turtle.dropUp()
- end
- turtle.select(16)
- turtle.digUp()
- turtle.select(1)
- end
- end
- local function forward()
- while not turtle.forward() do
- turtle.dig()
- turtle.attack()
- chest()
- end
- end
- local function down()
- turtle.digDown()
- turtle.down()
- depth = depth + 1
- end
- local function digLine()
- turtle.select(1)
- for i = 1,size-1 do
- forward()
- while turtle.detectUp() do
- turtle.digUp()
- end
- turtle.digDown()
- end
- end
- local function left()
- turtle.turnLeft()
- forward()
- while turtle.detectUp() do
- turtle.digUp()
- end
- turtle.digDown()
- turtle.turnLeft()
- end
- local function right()
- turtle.turnRight()
- forward()
- while turtle.detectUp() do
- turtle.digUp()
- end
- turtle.digDown()
- turtle.turnRight()
- end
- local function spin()
- turtle.turnRight()
- turtle.turnRight()
- end
- local function back()
- spin()
- for i = 1,size-1 do
- forward()
- end
- turtle.turnRight()
- for i = 1,size-1 do
- forward()
- end
- turtle.turnRight()
- end
- local function layer()
- for i = 1,size do
- digLine()
- if i%size == 0 then
- if i%2 == 0 then
- turtle.turnRight()
- for i = 1,size-1 do
- forward()
- end
- turtle.turnRight()
- else
- back()
- end
- elseif i%2 == 1 then
- right()
- else
- left()
- end
- end
- end
- local function quarry()
- layer()
- for i = 1,3 do
- down()
- end
- end
- -- Main Code
- down()
- down()
- repeat
- quarry()
- until turtle.detectDown() and not turtle.digDown()
- repeat
- turtle.up()
- depth = depth - 1
- until depth == 0
Advertisement
Add Comment
Please, Sign In to add comment