Advertisement
Fatherless

excavate

Dec 6th, 2024 (edited)
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. -- Get dimensions of box
  2. print("How much in front of me do you want to clear out?")
  3. local z = read()
  4. print("How much horizontal space?")
  5. local x = read()
  6. print("How much vertical space?")
  7. local y = read()
  8.  
  9. -- Functions
  10. local function fwd()
  11.     while not turtle.forward() do
  12.         turtle.dig()
  13.     end
  14. end
  15.  
  16. local function moveUp()
  17.     while not turtle.up() do
  18.         turtle.digUp()
  19.     end
  20. end
  21.  
  22. local function moveDown()
  23.     while not turtle.down() do
  24.         turtle.digDown()
  25.     end
  26. end
  27.  
  28. local function clearRow()
  29.     turtle.turnRight()
  30.     for i = 1, x - 1 do
  31.         fwd()
  32.     end
  33.     turtle.turnRight()
  34.     turtle.turnRight()
  35.     for i = 1, x - 1 do
  36.         fwd()
  37.     end
  38.     turtle.turnRight()
  39. end
  40.  
  41. local function clearFace()
  42.     clearRow()
  43.     for i = 1, y - 1 do
  44.         moveUp()
  45.         clearRow()
  46.     end
  47.     for i = 1, y - 1 do
  48.         moveDown()
  49.     end
  50. end
  51.  
  52. local function clearAll()
  53.     for i = 1, z do
  54.         fwd()
  55.         clearFace()
  56.     end
  57.     -- return to start
  58. end
  59.  
  60. clearAll()
  61.  
  62. for i = 1, z do
  63.     turtle.back()
  64. end
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement