DrFair

Branch nofuel

Jun 8th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. Args = {...}
  2.  
  3. function digfor()
  4. while turtle.detect() do
  5. turtle.dig()
  6. os.sleep(0.5)
  7. end
  8. turtle.forward()
  9. end
  10.  
  11. function digup()
  12. while turtle.detectUp() do
  13. turtle.digUp()
  14. os.sleep(0.5)
  15. end
  16. end
  17.  
  18. function torch()
  19. turtle.turnRight()
  20. turtle.turnRight()
  21. turtle.select(1)
  22. turtle.place()
  23. turtle.turnRight()
  24. turtle.turnRight()
  25. end
  26.  
  27. function checkdown()
  28. if turtle.detectDown() == false then
  29. turtle.select(2)
  30. turtle.placeDown()
  31. end
  32. end
  33.  
  34. if #Args ~= 1 then
  35. print("Usage: branch <num>")
  36. n = 0
  37. else
  38. print("Branching "..Args[1].." blocks forward.")
  39. print("Torches: slot 1, cobble: slot 2.")
  40. turtle.select(1)
  41. for i=1,Args[1] do
  42. n = n + 1
  43. digfor()
  44. digup()
  45. checkdown()
  46. if n == 7 then
  47. torch()
  48. n = 0
  49. end
  50. end
  51. turtle.up()
  52. for i=1,Args[1] do
  53. turtle.back()
  54. end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment