streqicity

Branch Mine Beta

Jan 24th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. --Author: Streqicity
  2. --Version: 0.0.8
  3. --Purpose: Branch Miner
  4. --Date: 1/24/2015
  5.  
  6.  
  7. args = {...}
  8. intNumberBranches = args[1]
  9. intBranchLength = args[2]
  10.  
  11. function mainTunnelForward()
  12. checkInv()
  13. turtle.dig()
  14. while not turtle.forward() do
  15. turtle.dig()
  16. end
  17. turtle.digUp()
  18. turtle.digDown()
  19. end
  20.  
  21. function mainTunnelTotal()
  22. mainTunnelForward()
  23. mainTunnelForward()
  24. mainTunnelForward()
  25. end
  26.  
  27. function sideTunnelForward(Length,Direction)
  28.  
  29. if Direction == "Left" then
  30. turtle.turnLeft()
  31. else
  32. turtle.turnRight()
  33. end
  34. for k = 1,Length do
  35. checkInv()
  36. turtle.dig()
  37. while not turtle.forward() do
  38. turtle.dig()
  39. end
  40. turtle.digUp()
  41. turtle.digDown()
  42. if k % 7==0 then
  43. placeTorch()
  44. end
  45. end
  46. UTurn()
  47. for k = 1,Length do
  48. while not turtle.forward() do
  49. turtle.dig()
  50. end
  51. end
  52.  
  53. if Direction == "Left" then
  54. turtle.turnLeft()
  55. else
  56. turtle.turnRight()
  57. end
  58. end
  59.  
  60. function checkFuel()
  61. if turtle.getFuelLevel()<80 then
  62. print("Need MOAR fuel please deposit in first slot")
  63. turtle.select(1)
  64. while not turtle.refuel() do
  65. sleep(1)
  66. end
  67. else
  68. return
  69. end
  70. end
  71.  
  72. function checkInv()
  73.  
  74. for k = 6,16 do
  75. if turtle.getItemCount(k) == 0 then
  76. return
  77. end
  78. end
  79. turtle.select(4)
  80. turtle.placeUp()
  81. for k = 6,16 do
  82. turtle.select(k)
  83. while not turtle.dropUp() do
  84. print("Chest full please check")
  85. sleep(1)
  86. end
  87. end
  88. turtle.select(4)
  89. turtle.digUp()
  90. end
  91.  
  92. function UTurn()
  93. turtle.turnLeft()
  94. turtle.turnLeft()
  95. end
  96.  
  97. function placeTorch()
  98. turtle.select(2)
  99. turtle.down()
  100. if turtle.detectDown() then
  101. turtle.up()
  102. turtle.placeDown()
  103. else
  104. turtle.select(3)
  105. turtle.placeDown()
  106. turtle.up()
  107. turtle.select(2)
  108. turtle.placeDown()
  109. end
  110. end
  111.  
  112. for k = 1,intNumberBranches do
  113. checkFuel()
  114. mainTunnelTotal()
  115. placeTorch()
  116. checkFuel()
  117. sideTunnelForward(intBranchLength,"Left")
  118. checkFuel()
  119. sideTunnelForward(intBranchLength,"Right")
  120. end
Advertisement
Add Comment
Please, Sign In to add comment