Advertisement
mortarsynth

tunnelSM

Jul 18th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. function tunnel(depth)
  2.  
  3. local function refuel()
  4. if turtle.getFuelLevel() < 100 then
  5. turtle.select(1)
  6. turtle.refuel(2)
  7. print("Refueled")
  8. end
  9. end
  10.  
  11. local function checkFull()
  12. if turtle.getItemCount(16) > 0 then
  13. turtle.back()
  14. turtle.digDown()
  15. turtle.select(2)
  16. turtle.placeDown()
  17. for i = 3, 16 do
  18. turtle.select(i)
  19. turtle.dropDown()
  20. end
  21. turtle.select(3)
  22. turtle.forward()
  23. end
  24. end
  25.  
  26. local function forcePlace()
  27. turtle.back()
  28. turtle.digDown()
  29. turtle.select(2)
  30. turtle.placeDown()
  31. turtle.forward()
  32. end
  33.  
  34. local function mine()
  35. while turtle.detect() do
  36. turtle.dig()
  37. sleep(0.5)
  38. end
  39. turtle.forward()
  40. while turtle.detectUp() do
  41. turtle.digUp()
  42. sleep(0.5)
  43. end
  44. end
  45.  
  46. for depth_count = 1, depth do
  47. refuel()
  48. checkFull()
  49. mine()
  50. end
  51. forcePlace()
  52.  
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement