Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This will dig a 3 x 3 tunnel, place torches and
- -- return. Place the turtle one block up
- -- from the floor.
- -- Usage: 3tunnel 5
- -- It will mine a 3 x 3 tunnel, 5 blocks long.
- -- Original code by SeleckPlays.
- -- https://www.youtube.com/watch?v=ftiOe6ztQg4
- -- Slightly modded by 25hz
- function digIt()
- while turtle.detect() do
- turtle.dig()
- os.sleep(1.0)
- end
- turtle.forward()
- while turtle.detectDown() or turtle.detectUp() do
- turtle.digUp()
- turtle.digDown()
- end
- end
- function placeTorch()
- turtle.back()
- turtle.turnLeft()
- turtle.forward()
- turtle.select(13)
- turtle.placeUp()
- turtle.back()
- turtle.turnRight()
- turtle.forward()
- end
- local run = 0
- local j = 0
- local k = 0
- term.write("Tunnel length? ")
- run = read()
- -- This places the torches. Change
- -- the number after the % sign to
- -- change how far apart the torches are.
- for i = 1, run do
- k = i - 1
- j = k % 5
- if j == 1 then
- placeTorch()
- end
- digIt()
- turtle.turnLeft()
- digIt()
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- digIt()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- end
- -- This makes the turtle return to start
- -- at ground level.
- turtle.down()
- turtle.turnRight()
- turtle.turnRight()
- for i = 1, run do
- turtle.forward()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement