Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function startTunnel(lenght)
- local distance = 0
- for i=1, lenght, 1 do
- checkBlock()
- dig()
- forward()
- checkBlock()
- turnRight(1)
- digUp()
- dig()
- forward()
- checkBlock()
- digUp()
- turnLeft(2)
- forward()
- turnRight(1)
- distance = distance + 1
- print("Distance: " .. distance)
- end
- end
- function dig()
- while turtle.detect() do
- turtle.dig()
- end
- end
- function forward()
- turtle.forward()
- end
- function checkBlock()
- if turtle.getItemCount(1) > 0 then
- while not turtle.detectDown() do
- turtle.select(1)
- turtle.placeDown()
- end
- else
- print("No Blocks in slot 1!!!!")
- sleep(10)
- checkBlock()
- end
- end
- function up()
- while turtle.detectUp() do
- turtle.digUp()
- end
- turtle.up()
- end
- function digUp()
- while turtle.detectUp() do
- turtle.digUp()
- end
- end
- function down()
- while turtle.detectDown() do
- turtle.digDown()
- end
- turtle.down()
- end
- function digDown()
- while turtle.detectDown() do
- turtle.digDown()
- end
- end
- function turnRight(e)
- for i1=1, e, 1 do
- turtle.turnRight()
- end
- end
- function turnLeft(e1)
- for i2=1, e1, 1 do
- turtle.turnLeft()
- end
- end
- print("Lenght: ")
- local lenght = read()
- startTunnel(lenght)
Advertisement
Add Comment
Please, Sign In to add comment