Advertisement
HappySunChild

mine2

Apr 16th, 2025 (edited)
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. if #arg == 0 then
  2.     arg = { ... }
  3. end
  4.  
  5. local xSize, ySize, zSize = tonumber(arg[1]), tonumber(arg[2]), tonumber(arg[3])
  6.  
  7. local function forward()
  8.     repeat
  9.         turtle.dig()
  10.     until turtle.forward()
  11. end
  12.  
  13. local function mineX()
  14.     for _ = 1, xSize do
  15.         turtle.digUp()
  16.         turtle.digDown()
  17.  
  18.         forward()
  19.     end
  20.  
  21.     turtle.digUp()
  22.     turtle.digDown()
  23. end
  24.  
  25. local function mineZ(y)
  26.     for z = 1, zSize do
  27.         mineX()
  28.  
  29.         if z == zSize then
  30.             break
  31.         end
  32.  
  33.         local d = 0
  34.  
  35.         -- only alternate if even z size
  36.         if zSize % 2 == 0 then
  37.             d = y - 1
  38.         end
  39.  
  40.         if z % 2 ~= d then
  41.             turtle.turnRight()
  42.  
  43.             forward()
  44.  
  45.             turtle.turnRight()
  46.         else
  47.             turtle.turnLeft()
  48.  
  49.             forward()
  50.  
  51.             turtle.turnLeft()
  52.         end
  53.     end
  54. end
  55.  
  56. for y = 1, math.abs(ySize) do
  57.     mineZ(y)
  58.  
  59.     turtle.turnRight()
  60.     turtle.turnRight()
  61.  
  62.     if y == math.abs(ySize) then
  63.         break
  64.     end
  65.  
  66.     if ySize < 0 then
  67.         for _ = 1, 3 do
  68.             turtle.digDown()
  69.             turtle.down()
  70.         end
  71.     else
  72.         for _ = 1, 3 do
  73.             turtle.digUp()
  74.             turtle.up()
  75.         end
  76.     end
  77. end
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement