Advertisement
Guest User

Untitled

a guest
May 31st, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. local arg = { ... }
  2. local x = 6
  3. local y = 6
  4.  
  5.  
  6.  
  7.  
  8. function init()
  9. if not arg[1] == nil then
  10. x = tonumber(arg[1])
  11. if x < 1 then
  12. x = 6
  13. end
  14. end
  15.  
  16. if not arg[2] == nil then
  17. y = tonumber(arg[1])
  18. if x < 1 then
  19. x = 6
  20. end
  21. end
  22. end
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. function clearRow()
  30. local l = 1
  31.  
  32. while x > l do
  33. if turtle.detectDown then
  34. turtle.digDown()
  35. end
  36.  
  37. if turtle.detect() then
  38. turtle.dig()
  39. end
  40.  
  41. turtle.forward()
  42.  
  43. l = l + 1
  44. end
  45.  
  46. turtle.digDown()
  47. end
  48.  
  49.  
  50.  
  51.  
  52.  
  53. function turn(d)
  54. if d == 0 then
  55. turtle.turnRight()
  56. else
  57. turtle.turnLeft()
  58. end
  59. end
  60.  
  61.  
  62.  
  63.  
  64.  
  65. function harvest()
  66.  
  67. turtle.up()
  68.  
  69. if turtle.detect() then
  70. turtle.dig()
  71. end
  72.  
  73. turtle.forward()
  74.  
  75. -- turtle is now in position
  76.  
  77. local d = 0
  78. local w = 1
  79.  
  80. while w < y do
  81. clearRow()
  82.  
  83. turn(d)
  84.  
  85. if turtle.detect() then
  86. turtle.dig()
  87. end
  88.  
  89. turtle.forward()
  90. turn(d)
  91.  
  92. w = w + 1
  93.  
  94. if d == 1 then
  95. d = 0
  96. else
  97. d = 1
  98. end
  99. end
  100. end
  101.  
  102.  
  103.  
  104.  
  105.  
  106. init()
  107.  
  108. harvest()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement