mpaul97

digTest

Aug 7th, 2021 (edited)
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.88 KB | None | 0 0
  1. local length = read()
  2. local width = read()
  3.  
  4. local firstBlock = 1
  5. local secondBlock = 9
  6.  
  7. for j = 0, width-1, 1 do
  8.     for i = 0, length-1, 1 do
  9.         if turtle.detect() then
  10.             turtle.dig()
  11.         end
  12.         turtle.forward()
  13.         turtle.turnRight()
  14.         turtle.turnRight()
  15.         turtle.select(firstBlock)
  16.         if turtle.getItemCount() == 0 then
  17.             firstBlock = firstBlock + 1
  18.             if firstBlock > 8 then
  19.                 firstBlock = 1
  20.                 turtle.select(firstBlock)
  21.                 if turtle.getItemCount() == 0 then
  22.                     print("waiting for more primary material...")
  23.                 end
  24.                 while turtle.getItemCount() == 0 do
  25.                     sleep()
  26.                 end
  27.             end
  28.         end
  29.         turtle.select(secondBlock)
  30.         if turtle.getItemCount() == 0 then
  31.             secondBlock = secondBlock + 1
  32.             if secondBlock > 16 then
  33.                 secondBlock = 9
  34.                 turtle.select(secondBlock)
  35.                 if turtle.getItemCount() == 0 then
  36.                     print("waiting for more secondary material...")
  37.                 end
  38.                 while turtle.getItemCount() == 0 do
  39.                     sleep()
  40.                 end
  41.             end
  42.         end
  43.         if i == 0 or i == length-1 or j == 0 or j == width-1 then
  44.             turtle.select(firstBlock)
  45.             turtle.place()
  46.         else
  47.             turtle.select(secondBlock)
  48.             turtle.place()
  49.         end
  50.         turtle.turnRight()
  51.         turtle.turnRight()
  52.     end
  53.     if turtle.detect() then
  54.         turtle.dig()
  55.     end
  56.     if j % 2 == 0 then
  57.         turtle.turnRight()
  58.         turtle.forward()
  59.         turtle.turnRight()
  60.         turtle.forward()
  61.     else
  62.         turtle.turnLeft()
  63.         turtle.forward()
  64.         turtle.turnLeft()
  65.         turtle.forward()
  66.     end
  67. end
Add Comment
Please, Sign In to add comment