Guest User

StripMine

a guest
Oct 14th, 2015
1,496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. local args = {...}
  2.  
  3. local t = turtle
  4.  
  5. local n = args[1]
  6.  
  7.  
  8. function forceForward()
  9.   while not t.forward() do
  10.     t.dig()
  11.   end
  12. end
  13.  
  14. function forceUp()
  15.   while not t.up() do
  16.     t.digUp()
  17.   end
  18. end
  19.  
  20. function forceDown()
  21.   while not t.down() do
  22.     t.digDown()
  23.   end
  24. end
  25.  
  26. function mineLayer(layer)
  27.   if layer % 2 == 0 then
  28.     forceForward()
  29.     t.turnLeft()
  30.     t.dig()
  31.     forceUp()
  32.     t.dig()
  33.     if layer % 5 == 0 then
  34.       t.place()
  35.     end
  36.     forceUp()
  37.     t.dig()
  38.     t.turnRight()
  39.   else
  40.     forceForward()
  41.     t.turnLeft()
  42.     t.dig()
  43.     forceDown()
  44.     t.dig()
  45.     if layer % 5 == 0 then
  46.       t.place()
  47.     end
  48.     forceDown()
  49.     t.dig()
  50.     t.turnRight()
  51.   end
  52. end
  53.  
  54. for i = 0, n do
  55.   mineLayer(i)
  56. end
Add Comment
Please, Sign In to add comment