Advertisement
juliancardz

tunnel1

Nov 4th, 2016
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. function digIt()
  2.   while turtle.detect() do
  3.     turtle.dig()
  4.     os.sleep(0.5)
  5.   end
  6.  
  7.   while turtle.detectDown() or turtle.detectUp() do
  8.     turtle.digUp()
  9.     turtle.digDown()
  10.   end
  11.  
  12.   turtle.forward()
  13. end
  14.  
  15. function placeTorch()
  16.   turtle.down()
  17.   turtle.back()
  18.   turtle.select(16)
  19.   turtle.placeUp()
  20.   turtle.forward()
  21.   turtle.up()
  22. end
  23.  
  24. local run = 0
  25. local j = 0
  26. local k = 0
  27.  
  28. term.write("Branch length: ")
  29. run = read()
  30.  
  31. for i = 1, run do
  32.   k = i-1
  33.   j = k % 10
  34.   if j == 1 then
  35.     placeTorch()
  36.   end
  37.   digIt()
  38. end
  39.  
  40. turtle.down()
  41. turtle.turnRight()
  42. turtle.turnRight()
  43. turtle.select(16)
  44. turtle.placeUp()
  45.  
  46. for i = 1, run do
  47.   turtle.forward()
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement