Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- d = tonumber(read())
- l = tonumber(read())
- h = tonumber(read())
- turnRight = true
- fuelNeeded = d * l * h + d + l + h - 1
- fuelLevel = turtle.getFuelLevel()
- y = 0
- x = 0
- z = 0
- function clearInventory()
- turtle.turnRight()
- for i = 1, 16 do
- turtle.drop(64)
- end
- turtle.turnLeft()
- end
- function turnArround()
- turtle.turnRight()
- turtle.turnRight()
- end
- function returnToChest()
- for i = 1, y do
- turtle.up()
- end
- if (z > 0) then
- turnRight = not turnRight
- turn()
- for i = 1, z do
- turtle.forward()
- end
- turnRight = not turnRight
- turn()
- end
- if (turnRight) then turnArround() end
- for i = 1, x do
- turtle.forward()
- end
- turnArround()
- end
- function digAndMove(dir)
- array = {}
- skip = false
- detecting = false
- if (dir == 1) then detecting = turtle.detect() else detecting = turtle.detectDown() end
- while (detecting) do
- for i = 1, 16 do
- if (turtle.getItemCount(i) == not null) then
- a[i] = turtle.getItemCount(i)
- else
- skip = true
- end
- end
- if (dir == 1) then
- turtle.dig()
- elseif (dir == 2) then
- turtle.digUp()
- end
- turtle.suck()
- if (not skip) then
- for i = 1, 16 do
- if (turtle.getItemCount(i) == not a[i]) then break end
- if (i == 16) then
- returnToChest()
- clearInventory()
- for i = 1, y do
- turtle.down()
- end
- for i = 1, x do
- turtle.forward()
- end
- if (z > 0) then
- turtle.turnRight()
- for i = 1, z do
- turtle.forward()
- end
- end
- if (not turnRight) then turnArround() end
- break;
- end
- end
- end
- if (dir == 1) then detecting = turtle.detect() else detecting = turtle.detectDown() end
- end
- if (dir == 1) then
- turtle.forward()
- elseif (dir == 2) then
- turtle.down()
- end
- end
- function turn ()
- if (turnRight) then turtle.turnRight() else turtle.turnLeft() end
- end
- clearInventory()
- -- if (fuelLevel < fuelNeeded) then turtle.suck((fuelNeeded - fuelLevel) / 80) end
- digAndMove(1)
- x = x + 1
- for i = 1, h do
- for j = 1, l do
- if (j > 1) then
- turn()
- digAndMove(1)
- if ((y + 2) % 2 == 0) then z = z + 1 else z = z - 1 end
- turn()
- turnRight = not turnRight
- end
- for k = 2, d do
- digAndMove(1)
- if (turnRight) then x = x + 1 else x = x - 1 end
- end
- end
- if (i < h) then
- digAndMove(2)
- y = y + 1
- turnArround()
- end
- end
- returnToChest()
- clearInventory()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement