Advertisement
D34dP0ol64

QuadChunk Miner

Aug 7th, 2022 (edited)
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.90 KB | None | 0 0
  1. -- 4 miner per chunk instead of 1
  2.  
  3. local currentY = 0
  4. local y = 0
  5. local doubleChest = 0
  6. local pp = 0
  7. local Mario = 0
  8.  
  9. function digOne()
  10.     turtle.digDown()
  11.     while not turtle.forward() do
  12.         turtle.dig()
  13.     end
  14.     turtle.digDown()
  15. end
  16.  
  17. function yPos()
  18.     term.write("Please enter y pos of turtle: ")
  19.     y = read()
  20.     term.clear()
  21.     term.setCursorPos(1,1)
  22. end
  23.  
  24. function dig16()
  25.     for i = 1,15 do
  26.         digOne()
  27.     end
  28. end
  29.  
  30. function unload()
  31.     print("unloading...")
  32.     for x = 1,currentY do
  33.         while not turtle.up() do
  34.             turtle.digUp()
  35.         end
  36.     end
  37.     turtle.select(1)
  38.     for a = 1,16 do
  39.         turtle.dropUp()
  40.         turtle.select(a)
  41.         turtle.dropUp()
  42.     end
  43.     turtle.select(1)
  44.     print("unloaded!")
  45.     for x = 1,currentY do
  46.         while not turtle.down() do
  47.             turtle.digDown()
  48.         end
  49.     end
  50.     sleep(1)
  51.     term.clear()
  52.     term.setCursorPos(1,1)
  53. end
  54.    
  55. function checkInv()
  56.     print("refueling...")
  57.     turtle.select(1)
  58.     for a = 1,16 do
  59.         turtle.refuel()
  60.         turtle.select(a)
  61.         turtle.refuel()
  62.     end
  63.     print("done refueling!")
  64.     print("checking inventory...")
  65.     turtle.select(1)
  66.     for a = 1,16 do
  67.         turtle.select(a)
  68.         pp=turtle.getItemCount(a)
  69.         if pp < 1 then
  70.             Mario = Mario+1
  71.         end
  72.     end
  73.     if Mario < 5 then
  74.         unload()
  75.     end
  76.     Mario = 0
  77.     turtle.select(1)
  78.     print("done checking!")
  79.     sleep(5)
  80.     term.clear()
  81.     term.setCursorPos(1,1)
  82. end
  83.  
  84. function digRow2()
  85.     dig16()
  86.     turtle.turnLeft()
  87.     digOne()
  88.     turtle.turnLeft()
  89.     dig16()
  90.     turtle.turnRight()
  91.     digOne()
  92.     turtle.turnRight()
  93. end
  94.  
  95. function return1()
  96.     turtle.turnLeft()
  97.     for z = 1,15 do
  98.         turtle.forward()
  99.     end
  100.     turtle.turnLeft()
  101.     while not turtle.down() do
  102.         turtle.digDown()
  103.     end
  104. end
  105.  
  106. function digLayer()
  107.     for n = 1,7 do
  108.         digRow2()
  109.     end
  110.     dig16()
  111.     turtle.turnLeft()
  112.     digOne()
  113.     turtle.turnLeft()
  114.     dig16()
  115.     return1()
  116.     currentY = currentY + 1
  117. end
  118.  
  119. function fuelUp()
  120.     print("Please place fuel in the turtle in the next 5 secs")
  121.     sleep(5)
  122.     print("fueling up...")
  123.     for a = 1,16 do
  124.         turtle.refuel()
  125.         turtle.select(a)
  126.         turtle.refuel()
  127.     end
  128.     turtle.select(1)
  129.     print("Done")
  130.     sleep(1)
  131.     term.clear()
  132.     term.setCursorPos(1,1)
  133. end
  134.  
  135. function digging()
  136.     for q = 5,y do
  137.         print("digging...")
  138.         digLayer()
  139.         checkInv()
  140.     end
  141.     for x = 5,y do
  142.         turtle.up()
  143.     end
  144.     print("dug")
  145. end
  146.  
  147. function calcChest()
  148.     doubleChest = (((y-5)*16*16)/32)/54
  149.     print("You will need ",doubleChest," double chests to store what I will mine :) ")
  150.     sleep(5)
  151.     term.clear()
  152.     term.setCursorPos(1,1)
  153. end
  154.        
  155.  
  156. yPos()
  157. fuelUp()
  158. calcChest()
  159. digging()
  160.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement