Advertisement
Guest User

Untitled

a guest
Mar 13th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. args = {...}
  2. distance = args[1]
  3. currentDist = 0
  4. movingBack = false
  5. i = 0
  6.  
  7. turtle.refuel()
  8.  
  9. print("Fuel: " .. turtle.getFuelLevel())
  10. sleep(2)
  11. doMove(movingBack)
  12.  
  13. function doMove (back)
  14. if back then
  15. turtle.back()
  16. end
  17. if back == false then
  18. turtle.dig()
  19. turtle.forward()
  20.  
  21. end
  22. currentDist = currentDist + 1
  23.  
  24. i = i + 1
  25. if i % 10 == 0 then
  26. print("Fuel: " .. turtle.getFuelLevel())
  27. i = 0
  28. end
  29.  
  30. if currentDist == distance then
  31. if movingBack == false then
  32. currentDist = 0
  33. movingBack = true
  34. end
  35. if movingBack == true then
  36. return
  37. end
  38. end
  39. if currentDist < distance then
  40. doMove(movingBack)
  41. end
  42.  
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement