GNOOR1S

Turtle Quarry

Jun 11th, 2022 (edited)
1,020
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. local tArgs = {...}
  2. local hasChest = true
  3. local enderChestSlot = 15
  4.  
  5. function fuel()
  6.     if turtle.getFuelLevel() < 10 then
  7.         turtle.select(16)
  8.         turtle.refuel(1)
  9.         turtle.select(1)
  10.         print("turtle has refueled")
  11.     end
  12. end
  13.  
  14. function enderchest()
  15.     if hasChest then
  16.         print("supplying items")
  17.         turtle.select(enderChestSlot)
  18.         turtle.dig()
  19.         while not turtle.place() do turtle.dig() end
  20.         for i = 1, 14 do
  21.             turtle.select(i)
  22.             turtle.drop(64)
  23.         end
  24.         turtle.select(enderChestSlot)
  25.         turtle.dig()
  26.         turtle.select(1)
  27.     end
  28. end
  29.  
  30. local depth = 60
  31. function run()
  32.     for y = 1, tArgs[1] do
  33.         turtle.dig()
  34.         while not turtle.forward() do turtle.dig() end
  35.         print("going down")
  36.         for x = 1, depth do
  37.             fuel()
  38.             turtle.digDown()
  39.             turtle.down()
  40.         end
  41.         enderchest()
  42.         turtle.dig()
  43.         while not turtle.forward() do turtle.dig() end
  44.         for i = 1, depth do
  45.             turtle.digUp()
  46.             fuel()
  47.             turtle.up()
  48.         end
  49.         enderchest()
  50.         print("")
  51.     end
  52.     print("program has ended, restarting")
  53. end
  54.  
  55. run()
  56. term.clear()
  57. term.setCursorPos(1, 1)
  58. shell.run("startup")
Add Comment
Please, Sign In to add comment