orngix

Quarry

Feb 26th, 2013
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. args = {...}
  2. if #args ~= 3 then
  3. return
  4. end
  5. x,y,z = args[1], args[2], args[3]
  6. xt = 0
  7. yt = 1
  8. zt = 0
  9. mt = 0
  10. rotate = 0
  11. x = tonumber(x)
  12. y = tonumber(y)
  13. z = tonumber(z)
  14.  
  15. while true do
  16.  
  17. if zt == z then
  18. return
  19. end
  20.  
  21. while xt < x do
  22. if turtle.forward() == true then
  23. xt = xt + 1
  24. else
  25. if zt == 0 then
  26. while turtle.detect() == true do
  27. turtle.dig()
  28. sleep(1)
  29. end
  30. else
  31. turtle.dig()
  32. end
  33. end
  34. end
  35. mt = mt + 1
  36.  
  37. if xt == x and rotate == 0 and yt < y then
  38. turtle.turnRight()
  39. if zt == 0 then
  40. while turtle.detect() == true do
  41. turtle.dig()
  42. sleep(1)
  43. end
  44. else
  45. turtle.dig()
  46. end
  47. turtle.forward()
  48. turtle.turnRight()
  49. rotate = 1
  50. yt = yt + 1
  51. xt = 1
  52. end
  53.  
  54. if xt == x and rotate == 1 and yt < y then
  55. turtle.turnLeft()
  56. if zt == 1 then
  57. while turtle.detect() == true do
  58. turtle.dig()
  59. sleep(1)
  60. end
  61. else
  62. turtle.dig()
  63. end
  64. turtle.forward()
  65. turtle.turnLeft()
  66. rotate = 0
  67. xt = 1
  68. yt = yt + 1
  69. end
  70.  
  71. if mt == y and rotate == 0 and zt < z then
  72. if zt ~= z then
  73. turtle.digDown()
  74. turtle.down()
  75. else
  76. return
  77. end
  78. turtle.turnLeft()
  79. turtle.turnLeft()
  80. yt = 1
  81. mt = 0
  82. zt = zt + 1
  83. xt = 1
  84. rotate = 0
  85. end
  86.  
  87. if mt == y and rotate == 1 and zt < z then
  88. reset = 1
  89. while reset < x do
  90. turtle.back()
  91. reset = reset + 1
  92. end
  93. if zt ~= z then
  94. turtle.digDown()
  95. turtle.down()
  96. else
  97. return
  98. end
  99. yt = 1
  100. mt = 0
  101. zt = zt + 1
  102. xt = 1
  103. rotate = 0
  104. end
  105.  
  106.  
  107. shell.run('clear')
  108. print(rotate)
  109. print(mt)
  110.  
  111. os.queueEvent("Crash")
  112. os.pullEvent()
  113. end
Advertisement
Add Comment
Please, Sign In to add comment