Advertisement
RedstoneCommands

Untitled

Mar 7th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. local rowSize = 6
  2. local colSize = 10
  3. local turnLeft = true
  4. local skipMove = false
  5.  
  6. function goHome()
  7. local r,c
  8. turtle.turnLeft()
  9. turtle.turnLeft()
  10. for c=1,colSize-1 do
  11. turtle.forward()
  12. end
  13. turtle.turnLeft()
  14. for r=1,rowSize-1 do
  15. turtle.forward()
  16. end
  17. turtle.turnLeft()
  18. turtle.back()
  19.  
  20. function harvestRow()
  21. local c
  22. for c=1,colSize do
  23. if skipMove == true then
  24. skipMove = false
  25. else
  26. turtle.forward()
  27. end
  28.  
  29. turtle.digDown()
  30. end
  31. end
  32.  
  33. --
  34. -- Move and orient turtle onto next row
  35. --
  36. function nextRow()
  37. if turnLeft == true then
  38. turtle.turnLeft()
  39. turtle.forward()
  40. turtle.turnLeft()
  41. turnLeft = false
  42. else
  43. turtle.turnRight()
  44. turtle.forward()
  45. turtle.turnRight()
  46. turnLeft = true
  47. end
  48. skipMove = true
  49. end
  50.  
  51. --
  52. -- Call to start farming
  53. --
  54. function harvestField()
  55. local r
  56. for r=1,rowSize do
  57. harvestRow()
  58.  
  59. -- go to next row unless its the last
  60. if r~=colSize then
  61. nextRow()
  62. end
  63. end
  64. goHome()
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement