Advertisement
Zonkotron

Untitled

Jan 23rd, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.94 KB | None | 0 0
  1. length = 0
  2. count = 0
  3. Abstand = 0
  4.  
  5. args = {...}
  6.  
  7. if args[1] == "0" or args[1] == nil then
  8.  
  9. print("Korrektes Format lautet: Programmname <Ganglaenge> <Anzahl Abzweigungen> <Abstand Gänge> " )
  10. print("Ebefalls moeglich: Programmname <Ganglaenge>")
  11. print("Nix zu tun, fahre herunter !")
  12. return(0)
  13.  
  14. else
  15.  
  16. length = args[1]+0 -- bugfixes string
  17.  
  18. end
  19.  
  20.  
  21.  
  22. if args[2] == "0" or args[2] == nil then
  23.  
  24. count = 0
  25.  
  26. else
  27.  
  28. count = args[2]+0
  29.  
  30. end
  31.  
  32. if args[3] == "0" && args [2] == "0" or args[3] == nil && args [2] == "0" then
  33.  
  34. count = 0
  35.  
  36. else
  37.  
  38. count = args[2]+0
  39.  
  40. end
  41.  
  42. print("Fuehre aus: Zonkotron Miner V 0.2")
  43. print("Loescher Boehren!")
  44. print("Laenge:".. length)
  45. print("count:" .. count)
  46.  
  47.  
  48.  
  49.  
  50. function turn() -- Turns 180
  51.  
  52. turtle.turnRight()
  53. turtle.turnRight()
  54.  
  55. end
  56.  
  57.  
  58.  
  59.  
  60. function lDig(x) -- Digs a tunnel 2 spaces below cleared room
  61.  
  62. for i=1,x,1 do
  63.  
  64. if turtle.detect() then
  65. turtle.dig()
  66. end
  67.  
  68. turtle.forward()
  69.  
  70. if turtle.detectDown() then
  71. turtle.digDown()
  72. end
  73.  
  74.  
  75. end
  76.  
  77. end
  78.  
  79.  
  80.  
  81. function tDig(x) -- Digs a tunnel 3 label set ZONK
  82.  
  83. for i=1,x,1 do
  84.  
  85. while turtle.detect() do
  86.  
  87. turtle.dig()
  88. sleep(0.5)
  89.  
  90. end
  91.  
  92. turtle.forward()
  93.  
  94. if turtle.detectDown() then
  95.  
  96. turtle.digDown()
  97. end
  98.  
  99. while turtle.detectUp() do
  100.  
  101. turtle.digUp()
  102. sleep(0.5)
  103. end
  104.  
  105. end
  106.  
  107. end
  108.  
  109.  
  110.  
  111.  
  112. function sDig(y) -- Digs in a straight line
  113.  
  114. for i=1,y,1 do
  115.  
  116. if turtle.detect() then
  117.  
  118. turtle.dig()
  119.  
  120. end
  121.  
  122. turtle.forward()
  123.  
  124. end
  125.  
  126. end
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. function uDig(x) -- Digs an upper 2 high clearance tunnel
  134.  
  135. for i=1,x,1 do
  136.  
  137. while turtle.detect() do
  138. turtle.dig()
  139. sleep(0.5)
  140. end
  141.  
  142. if turtle.detectDown() then
  143. turtle.digDown()
  144. end
  145.  
  146. turtle.forward()
  147.  
  148. end
  149. end
  150.  
  151.  
  152.  
  153.  
  154.  
  155. -- Start Hauptprogramm
  156.  
  157.  
  158. if count == nil or count == 0 then
  159.  
  160. for i=1,3,1 do
  161.  
  162. while turtle.detectUp() do
  163.  
  164. turtle.digUp()
  165. sleep(0.5)
  166.  
  167. end
  168.  
  169. turtle.up()
  170. end
  171.  
  172. uDig(length)
  173. turn()
  174.  
  175. for i=1,2,1 do
  176.  
  177. if turtle.detectDown() then
  178.  
  179. turtle.digDown()
  180.  
  181. end
  182.  
  183. turtle.down()
  184.  
  185. end
  186.  
  187. if turtle.detectDown() then
  188.  
  189. turtle.digDown()
  190.  
  191. end
  192.  
  193. lDig(length)
  194. turtle.down()
  195. turn()
  196.  
  197.  
  198. else
  199. for i=1,count,1 do
  200.  
  201. turtle.turnRight()
  202.  
  203. for i=1,3,1 do
  204.  
  205. while turtle.detectUp() do
  206.  
  207. turtle.digUp()
  208. sleep(0.5)
  209. end
  210.  
  211. turtle.up()
  212.  
  213. end
  214.  
  215. uDig(length)
  216. turn()
  217.  
  218. for i=1,2,1 do
  219.  
  220. if turtle.detectDown() then
  221.  
  222. turtle.digDown()
  223. end
  224.  
  225. turtle.down()
  226. end
  227.  
  228. if turtle.detectDown() then
  229.  
  230. turtle.digDown()
  231. end
  232.  
  233. lDig(length)
  234. turtle.down()
  235. turtle.turnRight()
  236.  
  237. for i=1,3,1 do
  238.  
  239. turtle.forward()
  240.  
  241. if turtle.detect() then
  242.  
  243. print("Tunnel End,Aborting Branch process")
  244. return(0)
  245.  
  246. end
  247. end
  248.  
  249. end
  250.  
  251. end
  252. print("Finished!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement