Advertisement
Zonkotron

Untitled

Mar 4th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. args = {...}
  2. length = args[1]+0 -- bugfixes string
  3. count = args[2]+0
  4.  
  5. if length == 0 or length == nil then
  6. print("Nothing to do, shutting down!")
  7. return(0)
  8. end
  9.  
  10. print("Now running Zonkotron Miner V 0.1")
  11. print("Loescher Boehren!")
  12. print("length:".. length)
  13. print("count:" .. count)
  14.  
  15.  
  16.  
  17.  
  18. function turn() -- Turns 180
  19. turtle.turnRight()
  20. turtle.turnRight()
  21. end
  22.  
  23.  
  24.  
  25. function tDig(x) -- Digs a tunnel 3 label set ZONK
  26.  
  27. for i=1,x,1 do
  28.  
  29. while turtle.detect() do
  30. turtle.dig()
  31. sleep(0.5)
  32. end
  33.  
  34. turtle.forward()
  35.  
  36. if turtle.detectDown() then
  37. turtle.digDown()
  38. end
  39.  
  40. while turtle.detectUp() do
  41. turtle.digUp()
  42. sleep(0.5)
  43. end
  44.  
  45. end -- end of for 1,x,1
  46.  
  47. end -- end of tDig()
  48.  
  49.  
  50.  
  51. function sDig(y) -- Digs in a straight line
  52.  
  53. for i=1,y,1 do
  54.  
  55. if turtle.detect() then
  56. turtle.dig()
  57. end
  58.  
  59. turtle.forward()
  60.  
  61. end
  62.  
  63. end -- end function
  64.  
  65.  
  66.  
  67.  
  68. if count == nil or count == 0 then
  69. turtle.up()
  70. turtle.up()
  71. tDig(length)
  72. turn()
  73. if turtle.detectDown() then
  74. turtle.digDown()
  75. end
  76. turtle.down()
  77. if turtle.detectDown() then
  78. turtle.digDown()
  79. end
  80. turtle.down()
  81. sDig(length)
  82. turn()
  83.  
  84.  
  85. else
  86. for i=1,count,1 do
  87.  
  88. turtle.turnRight()
  89. turtle.up()
  90. turtle.up()
  91. tDig(length)
  92. turn()
  93. if turtle.detectDown() then
  94. turtle.digDown()
  95. end
  96. turtle.down()
  97. if turtle.detectDown() then
  98. turtle.digDown()
  99. end
  100. turtle.down()
  101. sDig(length)
  102. turtle.turnRight()
  103. turtle.forward()
  104. turtle.forward()
  105. turtle.forward()
  106. turtle.forward()
  107. turn()
  108. end
  109. end
  110. print("Finished!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement