drexplosionpd

room2

Jan 21st, 2024 (edited)
947
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. ARGS = {...}
  2. x = tonumber(ARGS[1])
  3. y = tonumber(ARGS[2])
  4. z = tonumber(ARGS[3])
  5. if ARGS[1] == nil or ARGS[2] == nil or ARGS[3] == nil then
  6.     print (ARGS[0].." requires 3 numbers to determine size x,y,z")
  7.     os.exit()
  8. end
  9.  
  10. function dig()
  11.     while turtle.detect() do
  12.         turtle.dig()
  13.     end
  14. end
  15.  
  16. function digUp()
  17.     while turtle.detectUp() do
  18.         turtle.digUp()
  19.         sleep(0.4)
  20.     end
  21. end
  22.  
  23. flag = 1
  24.  
  25.  
  26. for iy = 1,y do
  27.     for iz = 1,z do
  28.         for ix = 1,x do
  29.             dig()
  30.             turtle.forward()
  31.         end
  32.  
  33.         if iz ~= z then
  34.             if iz%2 == flag then
  35.                 turtle.turnRight()
  36.                 dig()
  37.                 turtle.forward()
  38.                 turtle.turnRight()
  39.             else
  40.                 turtle.turnLeft()
  41.                 dig()
  42.                 turtle.forward()
  43.                 turtle.turnLeft()
  44.             end
  45.         else
  46.             turtle.turnLeft()
  47.             turtle.turnLeft()
  48.         end
  49.     end
  50.     digUp()
  51.     turtle.up()
  52.     if flag == 0 then
  53.         flag = 1
  54.     else
  55.         flag = 0
  56.     end
  57. end
Advertisement
Add Comment
Please, Sign In to add comment