BleynChannel

mine

Aug 5th, 2023
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | Gaming | 0 0
  1. local args = {...}
  2. local w = args[1] or 3
  3. local h = args[2] or 3
  4.  
  5. function fuel()
  6.     turtle.refuel()
  7.     if not turtle.getFuelLevel() == 0 then
  8.         print("Out of fuel")
  9.         return false
  10.     end
  11.     return true
  12. end
  13.  
  14. function square()
  15.     turtle.dig()
  16.     turtle.forward()
  17.     turtle.turnRight()
  18.  
  19.     for i = 1, h-1 do
  20.         for _ = 1, w-1 do
  21.             turtle.dig()
  22.             turtle.forward()
  23.         end
  24.        
  25.         if i < h-1 then
  26.             turtle.digDown()
  27.             turtle.down()
  28.            
  29.             for _ = 1, 2 do
  30.                 turtle.turnLeft()
  31.             end
  32.         end
  33.     end
  34. end
  35.  
  36. function move()
  37.     while true do
  38.         square()
  39.        
  40.         if h % 2 == 1 then
  41.             for _ = 1, 2 do
  42.                 turtle.turnLeft()
  43.             end
  44.            
  45.             for _ = 1, w-1 do
  46.                 turtle.forward()
  47.             end
  48.         end
  49.        
  50.         turtle.turnRight()
  51.        
  52.         for _ = 1, h-2 do
  53.             turtle.up()
  54.         end
  55.     end
  56. end
  57.  
  58. if fuel() then
  59.     move()
  60. end
Advertisement
Add Comment
Please, Sign In to add comment