Advertisement
bcash8

Flatten_Area

Jul 27th, 2022
787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. local args = {...}
  2.  
  3. local l = args[1]
  4. local w = args[2]
  5.  
  6. function digUp()
  7.     if turtle.detectUp() then
  8.         repeat turtle.digUp() until turtle.up()
  9.         digUp()
  10.         turtle.down()
  11.     end
  12.     return
  13. end
  14.  
  15. function dig()
  16.     repeat turtle.dig() until turtle.forward()
  17. end
  18.  
  19. for i = 1, l do
  20.     for b = 1, w do
  21.         dig()
  22.         digUp()
  23.     end
  24.     if i % 2 ~= 0 then
  25.         turtle.turnLeft()
  26.         dig()
  27.         digUp()
  28.         turtle.turnLeft()
  29.     else
  30.         turtle.turnRight()
  31.         dig()
  32.         digUp()
  33.         turtle.turnRight()
  34.     end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement