Megaddd

Untitled

Jul 17th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 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. digUp()
  35. if turtle.detectDown() == false then
  36. turtle.placeDown()
  37. end
  38. end
  39.  
  40. function tunnel(x)
  41. for i=1,x do
  42. forward()
  43. if i % 12 == 0 then
  44. turtle.turnLeft()
  45. turtle.turnLeft()
  46. turtle.select(15)
  47. turtle.place()
  48. turtle.select(1)
  49. turtle.turnLeft()
  50. turtle.turnLeft()
  51. end
  52. end
  53. end
  54.  
  55. tunnel(length)
Add Comment
Please, Sign In to add comment