osmarks

FastApproxDig

Aug 14th, 2021 (edited)
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. local fwd, right, up = ...
  2. fwd, right, up = tonumber(fwd), tonumber(right), tonumber(up)
  3.  
  4. local function checkFull()
  5.     while turtle.getItemCount(16) > 0 do
  6.         write "Please clear inventory"
  7.        
  8.         read()
  9.     end
  10. end
  11.  
  12. local j = 1
  13. local function digLevel()
  14.     for i = 1, right do
  15.         for i = 1, fwd do
  16.             turtle.digDown()
  17.             turtle.digUp()
  18.             turtle.dig()
  19.             turtle.forward()
  20.             checkFull()
  21.         end
  22.         if i ~= right then
  23.             local dir = turtle.turnRight
  24.             if j % 2 == 0 then dir = turtle.turnLeft end
  25.             dir()
  26.             turtle.dig()
  27.             turtle.forward()
  28.             dir()
  29.             j = j + 1
  30.         end
  31.     end
  32.     while turtle.getFuelLevel() < 500 do
  33.         write "Fuel low"
  34.         read()
  35.         turtle.refuel(1)
  36.     end
  37. end
  38.  
  39. for i = 1, up, 3 do
  40.     digLevel()
  41.     for i = 1, 3 do
  42.         turtle.digUp()
  43.         turtle.up()
  44.     end
  45.     turtle.turnRight()
  46.     turtle.turnRight()
  47. end
Add Comment
Please, Sign In to add comment