stripmine75 v0.1


SUBMITTED BY: Guest

DATE: Aug. 14, 2013, 3:15 a.m.

FORMAT: Text only

SIZE: 3.0 kB

HITS: 1298

  1. c9e8e1b9dd2870c0----
  2. --[[Computer slot 1, Filter slot 2, Timer slot 3, Chest slot 4, Fuel slot 15, torches slot 16.]]
  3. -- Create the function for refueling
  4. function checkFuel()
  5. if turtle.getFuelLevel() <= 20 then
  6. if turtle.getItemCount(15) == 0 then
  7. print("Out of fuel.")
  8. exit()
  9. else
  10. turtle.select(15)
  11. turtle.refuel(1)
  12. turtle.select(1)
  13. end --if
  14. end --if
  15. end --checkFuel()
  16. -- Create the turnAround function
  17. function turnAround()
  18. turtle.turnRight()
  19. turtle.turnRight()
  20. end --turnAround()
  21. -- Digs the tunnel for the given length
  22. function tunnel(givenLength)
  23. local torchDistance = 0
  24. d = 0
  25. while d <= 75 do
  26. if turtle.detect() then
  27. repeat
  28. turtle.dig()
  29. sleep(0.50)
  30. until turtle.detect() == false
  31. end --if
  32. turtle.forward()
  33. if turtle.detectUp() then
  34. repeat
  35. turtle.digUp()
  36. sleep(0.50)
  37. until turtle.detectUp() == false
  38. end --if
  39. turtle.turnLeft()
  40. if turtle.detect() then
  41. repeat
  42. turtle.dig()
  43. sleep(0.50)
  44. until turtle.detect() == false
  45. end --if
  46. turtle.up()
  47. if turtle.detect() then
  48. repeat
  49. turtle.dig()
  50. sleep(0.50)
  51. until turtle.detect() == false
  52. end--if
  53. turtle.turnRight()
  54. turtle.turnRight()
  55. if turtle.detect() then
  56. repeat
  57. turtle.dig()
  58. sleep(0.50)
  59. until turtle.detect() == false
  60. end
  61. turtle.down()
  62. if turtle.detect() then
  63. repeat
  64. turtle.dig()
  65. sleep(0.50)
  66. until turtle.detect() == false
  67. end
  68. turtle.turnLeft()
  69. d = d + 1
  70. torchDistance = torchDistance + 1
  71. -- attempts to place a block below
  72. turtle.select(1)
  73. turtle.placeDown()
  74. -- Places a torch every 9 blocks
  75. if torchDistance == 9 then
  76. print("Placing torch...")
  77. turtle.select(16)
  78. turnAround()
  79. turtle.place()
  80. turnAround()
  81. torchDistance = 0
  82. checkFuel()
  83. end --if
  84. end --for
  85. -- Sends the turtle back to the start
  86. turtle.up()
  87. turnAround()
  88. for index = 1,givenLength do
  89. checkFuel()
  90. if not turtle.detect() then
  91. turtle.forward()
  92. else
  93. repeat
  94. turtle.dig()
  95. turtle.sleep(0.25)
  96. until turtle.detect() == false
  97. turtle.forward()
  98. end --if
  99. end --for
  100. turtle.down()
  101. turnAround()
  102. end --tunnel()
  103. -- Main script
  104. print("Input tunnel length:")
  105. local length = 75
  106. print("Starting excavation...")
  107. tunnel(length)
  108. term.clear()
  109. print("The tunnel has been excavated!")

comments powered by Disqus