funkd0ct0r

Untitled

Dec 25th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. local sizeX, sizeY
  2. local curX = 0, curY = 0
  3. local slot = 1
  4.  
  5. sizeX, sizeY = ...
  6. turtle.select(slot)
  7.  
  8.  
  9. while true do
  10.  
  11. while turtle.getItemCount(slot) == 0 do
  12. slot = slot % 16 + 1
  13. turtle.select(slot)
  14. sleep(0)
  15. end
  16. turtle.placeDown()
  17.  
  18. if curX % 2 == 0 then
  19. if curZ == sizeZ - 1 then
  20. if curX == sizeX - 1 then
  21. return
  22. else
  23. turtle.turnRight()
  24. while not turtle.forward() do sleep(0) end
  25. turtle.turnRight()
  26. curX = curX + 1
  27. end
  28. else
  29. curZ = curZ + 1
  30. moveForward()
  31. end
  32. else -- curX % 2 ~= 0
  33.  
  34. if curZ == 0 then
  35. if curX == sizeX - 1 then
  36. return
  37. else
  38. turtle.turnLeft()
  39. while not turtle.forward() do sleep(0) end
  40. turtle.turnLeft()
  41. curX = curX + 1
  42. end
  43. else
  44. curZ = curZ - 1
  45. while not turtle.forward() do sleep(0) end
  46. end
  47.  
  48. end
  49.  
  50. end
Advertisement
Add Comment
Please, Sign In to add comment