Advertisement
Xonoa

deeperMine

Jan 16th, 2021 (edited)
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.60 KB | None | 0 0
  1. --functions that will be useful
  2. --turtle.compareTo(slot) - compares selected slot to argument slot. returns boolean
  3. --turtle.drop(count) - drops [count] numbeer of items from selected slot into inventory or into world. dropDown and dropUp exist
  4.  
  5. --put a short delay between attempts to mine forward to allow for water cooling of lava.  turtles now get stuck as cobble forms between
  6. --  digging and moving.  a short delay between testing if digging was successful should allow the water to flow into the spot and  
  7. --  cool any adjacent lava
  8.  
  9.  
  10. os.loadAPI("tMV.lua")
  11.  
  12. local sideLength = 8
  13.  
  14. --mines and moves forward
  15. function mineForward()
  16.     while turtle.dig() do
  17.         os.sleep(0.1)
  18.     end
  19.     while not tMV.tForward() do
  20.         os.sleep(0.1)
  21.     end
  22.     turtle.digDown()
  23.     turtle.digUp()
  24. end
  25.  
  26. --mines an 8x8 layer, 3 high
  27. function mineLayer()
  28.     for i=1,sideLength do
  29.         mineForward()
  30.     end
  31.     tMV.tTurnRight()
  32.     for i=(sideLength-1),1,-1 do
  33.         for j=1,2 do
  34.             for k=1,i do
  35.                 mineForward()
  36.             end
  37.             tMV.tTurnRight()
  38.         end
  39.         dumpCobble()
  40.     end
  41. end
  42.  
  43. --mines to the next layer down
  44. function layerDown(layerDepth)
  45.     tMV.face(1)
  46.     for i=1,layerDepth do
  47.         turtle.digDown()
  48.         tMV.tDown()
  49.     end
  50. end
  51.  
  52. --return to home and dump ores
  53. function dropOffOres()
  54.     tMV.goHome()
  55.     tMV.face(3)
  56.     for slot=2,16 do
  57.         turtle.select(slot)
  58.         turtle.drop()
  59.     end
  60. end
  61.  
  62. --dumps all cobble on the ground
  63. function dumpCobble()
  64.     for slot=2,16 do
  65.         turtle.select(slot)
  66.         if turtle.compareTo(1) then
  67.             turtle.dropDown(64)
  68.         end
  69.     end
  70. end
  71.  
  72. for layerDepth=3,12,3 do
  73.     mineLayer()
  74.     dropOffOres()
  75.     layerDown(layerDepth)
  76. end
  77.  
  78. tMV.goHome()
  79.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement