Megaddd

Minecraft tunnel assistant turtle

Jul 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. args = {...}
  2. length = args[1]
  3.  
  4. function checkfuel()
  5. if turtle.getFuelLevel() <= 4 then
  6. turtle.select(16)
  7. turtle.refuel(1)
  8. turtle.select(1)
  9. end
  10. end
  11.  
  12. function dig()
  13. while turtle.detect() do
  14. turtle.dig()
  15. os.sleep(.5)
  16. end
  17. end
  18.  
  19. function digUp()
  20. while turtle.detectUp() do
  21. turtle.digUp()
  22. os.sleep(.5)
  23. end
  24. end
  25.  
  26. function forward()
  27. checkfuel()
  28. while turtle.forward() == false do
  29. dig()
  30. turtle.attack()
  31. checkfuel()
  32. os.sleep(.5)
  33. end
  34. if turtle.detectDown() == false then
  35. turtle.placeDown()
  36. end
  37. end
  38.  
  39. function tunnel(le)
  40. for i=1,le do
  41. forward()
  42. digUp()
  43. end
  44. end
  45.  
  46. tunnel(length)
Advertisement
Add Comment
Please, Sign In to add comment