Advertisement
Guest User

t

a guest
Mar 29th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. function start()
  2.  
  3. moveFw(2)
  4.  
  5. turtle.turnRight()
  6. moveFw(1)
  7.  
  8. plantRowLeft()
  9.  
  10. for i=2, 4 do
  11. if(i%2 == 0) then
  12. turtle.turnLeft()
  13. moveFw(3)
  14. turtle.turnLeft();
  15. plantRowRight()
  16. else
  17. turtle.turnRight()
  18. moveFw(3)
  19. turtle.turnRight();
  20. plantRowLeft()
  21. end
  22. end
  23. end
  24.  
  25. function plantRowLeft()
  26. moveFw(1)
  27. placeTreeLeft()
  28.  
  29. for i=1, 3 do
  30. moveFw(3)
  31. placeTreeLeft()
  32. end
  33. moveFw(1);
  34. end
  35.  
  36. function plantRowRight()
  37. moveFw(1)
  38. placeTreeRight()
  39.  
  40. for i=1, 3 do
  41. moveFw(3)
  42. placeTreeRight()
  43. end
  44. moveFw(1);
  45. end
  46.  
  47. function moveFw(distance)
  48. if distance ~= nil then
  49. distance = tonumber (distance) -- make it a number
  50. for i = 1, distance do
  51. turtle.forward()
  52. end
  53. else
  54. print ("Did not specify distance.")
  55. end
  56. end
  57. function placeTreeLeft()
  58. turtle.turnLeft()
  59. turtle.select(3)
  60. turtle.place(Sapling)
  61. turtle.turnRight()
  62. turtle.forward()
  63. turtle.turnLeft()
  64. turtle.select(4)
  65. turtle.place(Torch)
  66. turtle.turnRight()
  67. end
  68.  
  69. function placeTreeRight()
  70. turtle.turnRight()
  71. turtle.select(3)
  72. turtle.place(Sapling)
  73. turtle.turnLeft()
  74. turtle.forward()
  75. turtle.turnRight()
  76. turtle.select(4)
  77. turtle.place(Torch)
  78. turtle.turnLeft()
  79. end
  80.  
  81. function refuel()
  82. turtle.select(16)
  83. turtle.refuel(5)
  84. end
  85.  
  86. function checkFuel()
  87. local fuel = turtle.getFuelLevel()
  88.  
  89. if (fuel < 10) then
  90. return false
  91. end
  92. return true
  93. end
  94.  
  95. refuel()
  96. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement