Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. local width = 7
  2. local length = 12
  3. local startLeft = true
  4.  
  5. local function farmSquare(w, l, left)
  6. local turnLeft = not left
  7. local slot = 1
  8.  
  9. turtle.select(slot)
  10.  
  11. for x = 1, w do
  12. for y = 1, l do
  13. turtle.digDown()
  14. turtle.digDown()
  15. turtle.placeDown()
  16.  
  17. if turtle.getItemCount(slot) == 0 then
  18. slot = slot + 1
  19. turtle.select(slot)
  20. end
  21.  
  22. if y ~= l then
  23. turtle.forward()
  24. end
  25. end
  26.  
  27. if x ~= w then
  28. if turnLeft then
  29. turtle.turnLeft()
  30. turtle.forward()
  31. turtle.turnLeft()
  32. turnLeft = false
  33. else
  34. turtle.turnRight()
  35. turtle.forward()
  36. turtle.turnRight()
  37. turnLeft = true
  38. end
  39. else
  40. if left then
  41. turtle.turnLeft()
  42. else
  43. turtle.turnRight()
  44. end
  45.  
  46. for i = 1, (w - 1) do
  47. turtle.forward()
  48. end
  49.  
  50. if left then
  51. turtle.turnRight()
  52. else
  53. turtle.turnLeft()
  54. end
  55.  
  56. for i = 1, (l - 1) do
  57. turtle.back()
  58. end
  59. end
  60. end
  61. end
  62.  
  63. print('starting')
  64.  
  65. farmSquare(width, length, startLeft)
  66.  
  67. print('finished')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement