Advertisement
gustav9797

harvest

Apr 18th, 2014
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. doLeft = true
  2.  
  3. function harvest(length, width)
  4. for i=1,width,1 do
  5. harvestLength(length)
  6. if width ~= i then
  7. if doLeft then
  8. left()
  9. else
  10. right()
  11. end
  12. end
  13. doLeft = not doLeft
  14. end
  15.  
  16. if doLeft then
  17. turtle.turnLeft()
  18. for i=2,width,1 do
  19. turtle.forward()
  20. end
  21. turtle.turnLeft()
  22. else
  23. for i=1,length,1 do
  24. turtle.back()
  25. end
  26. turtle.turnRight()
  27. for i=1,width,1 do
  28. turtle.forward()
  29. end
  30. turtle.turnLeft()
  31. end
  32. end
  33.  
  34. function harvestLength(length)
  35. thing = length - 1
  36. for i=1, thing,1 do
  37. turtle.digDown()
  38. replant()
  39. turtle.forward()
  40. end
  41. turtle.digDown()
  42. replant()
  43. end
  44.  
  45. function replant()
  46. turtle.select(1)
  47. turtle.placeDown()
  48. end
  49.  
  50. function left()
  51. turtle.turnLeft()
  52. turtle.forward()
  53. turtle.turnLeft()
  54. end
  55.  
  56. function right()
  57. turtle.turnRight()
  58. turtle.forward()
  59. turtle.turnRight()
  60. end
  61.  
  62. harvest(8,4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement