Bonzai1102

b-mine

Jan 4th, 2013
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. function fuel()
  2. if turtle.getFuelLevel() < 10 then
  3. for n=1,16 do
  4. if turtle.getItemCount(n) > 0 then
  5. turtle.select(n)
  6. if turtle.refuel(1) then
  7. turtle.select(1)
  8. end
  9. end
  10. end
  11. turtle.select(1)
  12. else
  13. print("Fuel: "..turtle.getFuelLevel().." ")
  14. end
  15. end
  16.  
  17. function turn()
  18. turtle.turnRight()
  19. turtle.turnRight()
  20. end
  21.  
  22. function tunnel()
  23. turtle.dig()
  24. sleep(0.5)
  25. turtle.forward()
  26. distance = distance + 1
  27. turtle.digUp()
  28. turtle.select(1)
  29. turtle.placeDown()
  30. turtle.turnRight()
  31. turtle.detect()
  32. turtle.place()
  33. turn()
  34. turtle.detect()
  35. turtle.place()
  36. turtle.turnRight()
  37.  
  38. if distance == 9 then
  39. turtle.select(16)
  40. print("Placing Torch...")
  41. turn()
  42. turtle.place()
  43. turn()
  44. distance = 0
  45. end
  46. end
  47.  
  48. function back()
  49. turtle.up()
  50. turn()
  51. for j = 1,length do
  52. turtle.forward()
  53. -- if turtle.forward() == false then
  54. turtle.dig()
  55. turtle.attack()
  56. -- end
  57. end
  58. turtle.down()
  59. turn()
  60. end
  61.  
  62. write("Tunnel length: ")
  63. length = read()
  64. print("Starting...")
  65. fuel()
  66. distance = 0
  67. i = 1
  68. while i < length do
  69. tunnel()
  70. end
  71. back()
  72. print("Done...")
Advertisement
Add Comment
Please, Sign In to add comment