Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. function main()
  2. while true do
  3. collect()
  4. clearInventory()
  5. goBack()
  6. refillInventory()
  7. end
  8. end
  9.  
  10. function collect()
  11. turtle.turnRight()
  12. turtle.turnRight()
  13. for i=0,14 do
  14. turtle.placeDown()
  15. while not turtle.forward() do
  16.  
  17. end
  18. end
  19. turtle.placeDown()
  20. end
  21.  
  22. function goBack()
  23. turtle.turnRight()
  24. turtle.turnRight()
  25. for i=0,14 do
  26. while not turtle.forward() do
  27. os.queueEvent("randomEvent")
  28. os.pullEvent()
  29. end
  30. end
  31. end
  32.  
  33. function clearInventory()
  34. local tmp = false
  35. if turtle.getFuelLevel()<500 then
  36. tmp = true
  37. end
  38. for i=1,16 do
  39. turtle.select(i)
  40. if tmp then
  41. turtle.refuel()
  42. end
  43.  
  44. while not turtle.drop() do
  45. os.queueEvent("randomEvent")
  46. os.pullEvent()
  47. end
  48.  
  49. end
  50. end
  51.  
  52. function refillInventory()
  53. turtle.suck(16)
  54. end
  55.  
  56. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement