Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.00 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1, 1)
  3.  
  4. repeat
  5. print("Enter tunnel length (even digit): ")
  6. tunnellength = read()
  7. until tunnellength % 2 == 0
  8.  
  9. term.clear()
  10. term.setCursorPos(1, 1)
  11.  
  12. print("Place Fuel in Slot 1")
  13. print("Enter number for fuel type: ")
  14. print("")
  15. print("No Fuel Required = 0")
  16. print("Coal/Charcoal/Peat = 1")
  17. print("Coal Coke = 2")
  18. print("Biofuel Can = 3 **")
  19. print("Coalfuel Can = 4 **")
  20. print("** Ensure these work in your version")
  21. fueltype = read()
  22.  
  23. function fueltypeset()
  24. if fueltype == "1" then
  25. fueltype = 80
  26. elseif fueltype == "2" then
  27. fueltype = 160
  28. elseif fueltype == "3" then
  29. fueltype = 520
  30. elseif fueltype == "4" then
  31. fueltype = 1520
  32. end
  33. end
  34. fueltypeset()
  35. term.clear()
  36. term.setCursorPos(1, 1)
  37.  
  38. print("Drop mined cobblestone? 0=No, 1=Yes")
  39. cobblesetting = read()
  40. term.clear()
  41. term.setCursorPos(1, 1)
  42. if cobblesetting == "1" then
  43. if turtle.getItemCount(2) < 1 then
  44. print("Place 1 cobblestone in Slot 2")
  45. print("")
  46. end
  47. end
  48.  
  49. print("Place torches? 0=No, 1=Yes")
  50. print("Place torches in Slot 3")
  51. torchsetting = read()
  52. term.clear()
  53. term.setCursorPos(1, 1)
  54. if torchsetting == "1" then
  55. if turtle.getItemCount(3) < tunnellength/4 then
  56. print("Warning: You will not have enough torches for entire tunnel length.")
  57. print("")
  58. print("")
  59. end
  60. end
  61.  
  62.  
  63. print("Return and deposit items to chest if inventory nears full?")
  64. print("0=No, 1=Yes")
  65. returnsetting = read()
  66. term.clear()
  67. term.setCursorPos(1, 1)
  68. if returnsetting == "1" then
  69. print("Place chest immediately behind turtle.")
  70. print("")
  71. end
  72.  
  73. print("Deposit inventory into chest upon completion?")
  74. print("0=No, 1=Yes")
  75. dcomplete = read()
  76. term.clear()
  77. term.setCursorPos(1, 1)
  78. if dcomplete == "1" then
  79. print("Place chest immediately behind turtle.")
  80. print("")
  81. end
  82.  
  83. print("Terminate program once length is reached?")
  84. print("Note: This will prevent the turtle from depositing items into a chest upon completion.")
  85. print("0=No, 1=Yes")
  86. tcomplete = read()
  87. term.clear()
  88. term.setCursorPos(1, 1)
  89. if tcomplete == "1" then
  90. if dcomplete == "1" then
  91. print("Turtle will NOT deposit items upon completion.")
  92. print("")
  93. end
  94. end
  95.  
  96. print("")
  97. print("Begin mining?")
  98. print("0=Cancel Program, Any Key=Yes")
  99. beginmine = read()
  100. if beginmine == "0" then
  101. os.reboot()
  102. end
  103.  
  104. term.clear()
  105. term.setCursorPos(1,1)
  106. if tcomplete == "1" then
  107. print("Tunneling " .. tunnellength .. " blocks, then terminating.")
  108. elseif tcomplete == "0" then
  109. print("Tunneling " .. tunnellength .. " blocks, then returning.")
  110. end
  111. sleep(2)
  112.  
  113. torchpos = 0
  114.  
  115. function progress()
  116. term.setCursorPos(1,3)
  117. print("Progress: " .. torchpos .. " of " .. tunnellength)
  118. end
  119.  
  120. function dropcobble()
  121. local stackSize = turtle.getItemCount(2)
  122. if cobblesetting == "1" then
  123. if 1 ~= 1 then
  124. if stackSize > 2 then
  125. stackSize = stackSize-1
  126. turtle.select(2)
  127. turtle.drop(stackSize)
  128. end
  129. end
  130. end
  131.  
  132.  
  133. function minewallRight()
  134. turtle.select(1)
  135. turtle.dig()
  136. moveforward()
  137. turtle.digUp()
  138. turtle.digDown()
  139. turtle.turnRight()
  140. moveforward()
  141. turtle.digDown()
  142. turtle.digUp()
  143. moveforward()
  144. turtle.digDown()
  145. turtle.digUp()
  146. turtle.turnLeft()
  147. torchpos = torchpos + 1
  148. progress()
  149. end
  150.  
  151. function minewallLeft()
  152. turtle.select(1)
  153. turtle.dig()
  154. moveforward()
  155. turtle.digUp()
  156. turtle.digDown()
  157. turtle.turnLeft()
  158. moveforward()
  159. turtle.digDown()
  160. turtle.digUp()
  161. moveforward()
  162. turtle.digDown()
  163. turtle.digUp()
  164. turtle.turnRight()
  165. torchpos = torchpos + 1
  166. progress()
  167. end
  168.  
  169. function minecycle()
  170. for z = 1, tunnellength/2 do
  171. minewallRight()
  172. minewallLeft()
  173. placetorch()
  174. end
  175. end
  176.  
  177. function placetorch()
  178. if torchsetting == "1" then
  179. if torchpos % 4 == 0 then
  180. turtle.turnLeft()
  181. turtle.dig()
  182. turtle.select(3)
  183. turtle.place()
  184. turtle.turnRight()
  185. dropcobble()
  186. fullinventory()
  187. turtle.select(1)
  188. end
  189. else
  190. if torchpos % 4 == 0 then
  191. dropcobble()
  192. fullinventory()
  193. turtle.select(1)
  194. end
  195. end
  196. end
  197.  
  198. function moveforward()
  199. while not turtle.forward() do
  200. sleep(0.25)
  201. turtle.dig()
  202. end
  203. end
  204.  
  205. function turtlehome()
  206. for y = 1, tunnellength do
  207. moveforward()
  208. end
  209. end
  210.  
  211.  
  212. function fullinventory()
  213. local invcount = 0
  214. if returnsetting == "1" then
  215. for c = 4, 16 do
  216. if turtle.getItemCount(c) > 0 then
  217. invcount = invcount+1
  218. end
  219. end
  220. if invcount > 12 then
  221. turtle.turnLeft()
  222. turtle.turnLeft()
  223. for f = 1, torchpos+1 do
  224. moveforward()
  225. end
  226. for d = 4, 16 do
  227. turtle.select(d)
  228. turtle.dropDown()
  229. end
  230. turtle.turnLeft()
  231. turtle.turnLeft()
  232. for f = 1, torchpos+1 do
  233. end
  234. invcount = 0
  235. else
  236. invcount = 0
  237. end
  238. end
  239. end
  240.  
  241. function depositcomplete()
  242. if dcomplete == "1" then
  243. for d = 1, 16 do
  244. turtle.select(d)
  245. turtle.drop()
  246. end
  247. end
  248. end
  249.  
  250. function terminatecomplete()
  251. if tcomplete =="1" then
  252. turtle.down()
  253. os.reboot()
  254. sleep(3)
  255. end
  256. end
  257.  
  258. turtle.digUp()
  259. turtle.up()
  260. minecycle()
  261. terminatecomplete()
  262. turtle.turnLeft()
  263. turtle.turnLeft()
  264. turtlehome()
  265. turtle.down()
  266. depositcomplete()
  267. turtle.turnRight()
  268. turtle.turnRight()
  269. term.setCursorPos(1,5)
  270. print("Mining Successful")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement