SummitSummit

Summit's Miner

Jul 4th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. ---- Turtle Mining Miner designed by DireWolf20 ----
  2. ---- Modified by SummitSummit 1 August 2013 ----
  3.  
  4.  
  5. rednet.open("right")
  6. local func
  7. local tArgs = {...}
  8.  
  9. function cleanup()
  10. for i = 1,12 do
  11. turtle.select(i)
  12. turtle.dropDown()
  13. end
  14. end
  15.  
  16. function place()
  17. turtle.select(16)
  18. turtle.place()
  19. turtle.down()
  20. turtle.select(15)
  21. turtle.place()
  22. turtle.select(14)
  23. turtle.placeDown()
  24. end
  25.  
  26. function remove()
  27. turtle.select(14)
  28. turtle.digDown()
  29. turtle.select(15)
  30. turtle.dig()
  31. turtle.up()
  32. turtle.select(16)
  33. turtle.dig()
  34. end
  35.  
  36. function fuel()
  37. turtle.select(13)
  38. turtle.placeUp()
  39. turtle.select(1)
  40. turtle.suckUp()
  41. turtle.dropUp(turtle.getItemCount(1) - 4)
  42. turtle.refuel()
  43. turtle.select(13)
  44. turtle.digUp()
  45. end
  46.  
  47. function fuelBoss()
  48. turtle.select(13)
  49. turtle.placeUp()
  50. turtle.select(1)
  51. turtle.suckUp()
  52. turtle.dropUp(turtle.getItemCount(1) - 4)
  53. turtle.select(13)
  54. turtle.digUp()
  55. turtle.up()
  56. turtle.turnRight()
  57. turtle.select(1)
  58. turtle.drop()
  59. turtle.turnLeft()
  60. turtle.down()
  61. end
  62.  
  63. function checkFuel()
  64. if turtle.getFuelLevel() < 400 then
  65. fuel()
  66. end
  67. end
  68.  
  69. function cycle()
  70. place()
  71. sleep(10)
  72. while turtle.getItemCount(1) > 0 do
  73. cleanup()
  74. sleep(2)
  75. end
  76. remove()
  77. checkFuel()
  78. turtle.forward()
  79. end
  80.  
  81. function checkIn(fromID)
  82. rednet.send(fromID, tArgs[1])
  83. end
  84.  
  85. function chunkLoad()
  86. turtle.select(16)
  87. turtle.digUp()
  88. checkFuel()
  89. turtle.select(16)
  90. turtle.forward()
  91. turtle.placeUp()
  92. end
  93.  
  94. function powerOn()
  95. turtle.select(1)
  96. turtle.place()
  97. turtle.down()
  98. turtle.select(2)
  99. turtle.place()
  100. turtle.attack()
  101. end
  102.  
  103. function powerOff()
  104. turtle.select(2)
  105. turtle.dig()
  106. turtle.up()
  107. turtle.select(1)
  108. turtle.dig()
  109. turtle.forward()
  110. end
  111.  
  112. function minersDown()
  113. turtle.down()
  114. end
  115.  
  116. function minersUp()
  117. turtle.up()
  118. end
  119.  
  120. function loadersDown()
  121. turtle.select(16)
  122. turtle.digUp()
  123. turtle.down()
  124. turtle.placeUp()
  125. end
  126.  
  127. function loadersUp()
  128. turtle.select(16)
  129. turtle.digUp()
  130. turtle.up()
  131. turtle.placeUp()
  132. end
  133.  
  134. while true do
  135. local id,msg,dist = rednet.receive()
  136. func = loadstring(msg.."(...)")
  137. setfenv(func, getfenv())
  138. func(id)
  139. rednet.send(id,"Done")
  140. end
Advertisement
Add Comment
Please, Sign In to add comment