Advertisement
Guest User

cc

a guest
Mar 29th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. function start()
  2.  
  3. moveFw(3)
  4.  
  5. turtle.turnRight()
  6. moveFw(1)
  7.  
  8. plantRow()
  9.  
  10. for i=2, 4 do
  11. if(i%2 == 0) then
  12. turtle.turnLeft()
  13. moveFw(4)
  14. turtle.turnLeft();
  15. else
  16. turtle.turnRight()
  17. moveFw(4)
  18. turtle.turnRight();
  19. end
  20. plantRow()
  21. end
  22. end
  23.  
  24. function plantRow()
  25. placeTree()
  26.  
  27. for i=1, 3 do
  28. moveFw(3)
  29. placeTree()
  30. end
  31. moveFw(1);
  32. end
  33.  
  34. function moveFw(distance)
  35. if distance ~= nil then
  36. distance = tonumber (distance) -- make it a number
  37. for i = 1, distance do
  38. turtle.forward()
  39. end
  40. else
  41. print ("Did not specify distance.")
  42. end
  43. end
  44. function placeTree()
  45. turtle.select(3)
  46. turtle.place(Sapling)
  47. turtle.forward()
  48. turtle.select(4)
  49. turtle.place(Torch)
  50. end
  51.  
  52.  
  53. function refuel()
  54. turtle.select(16)
  55. turtle.refuel(5)
  56. end
  57.  
  58. function checkFuel()
  59. local fuel = turtle.getFuelLevel()
  60.  
  61. if (fuel < 10) then
  62. return false
  63. end
  64. return true
  65. end
  66.  
  67. refuel()
  68. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement