Advertisement
freeadla

Untitled

Dec 20th, 2024 (edited)
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. local function digBlocks(blocks)
  2.     for i = 1, blocks do
  3.         turtle.dig()
  4.         turtle.forward()
  5.     end
  6. end
  7.  
  8. local function digLayers(length, width, depth)
  9.     length = length - 1
  10.     local turnDirection = "right"
  11.    
  12.     for i = 1, depth do
  13.         print(i ..  '/' .. depth .. " layers")
  14.  
  15.         for j = 1, width do
  16.             digBlocks(length)
  17.  
  18.             if turnDirection == "right" and j < width then
  19.                 turtle.turnRight()
  20.                 turtle.dig()
  21.                 turtle.forward()
  22.                 turtle.turnRight()
  23.                 turnDirection = "left"
  24.             elseif turnDirection == "left" and j < width then
  25.                 turtle.turnLeft()
  26.                 turtle.dig()
  27.                 turtle.forward()
  28.                 turtle.turnLeft()
  29.                 turnDirection = "right"
  30.             end
  31.         end
  32.  
  33.         if i < depth then
  34.             turtle.turnRight()
  35.             turtle.turnRight()
  36.             turtle.digDown()
  37.             turtle.down()
  38.         end
  39.     end
  40. end
  41.  
  42. local function main()
  43.     digLayers(3, 3, 6)
  44. end
  45.  
  46. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement