Advertisement
CmdDebugs

trainForwardQuarryV2

Apr 17th, 2021 (edited)
1,054
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. dist = read()
  2.  
  3. function dig_forward()
  4.     local success, data
  5.     while turtle.detect() do
  6.         success, data = turtle.inspect()
  7.         if success then
  8.             if (data.name ~= "computercraft:turtle_normal") and (data.name ~= "computercraft:turtle_advanced") then
  9.                 turtle.dig()
  10.             else
  11.                 break
  12.             end
  13.         else
  14.             turtle.dig()
  15.         end
  16.         sleep(0.5)
  17.     end
  18. end
  19.  
  20. function dig_up()
  21.     local success, data
  22.     while turtle.detectUp() do
  23.         success, data = turtle.inspectUp()
  24.         if success then
  25.             if (data.name ~= "computercraft:turtle_normal") and (data.name ~= "computercraft:turtle_advanced") then
  26.                 turtle.digUp()
  27.             else
  28.                 break
  29.             end
  30.         else
  31.             turtle.digUp()
  32.         end
  33.     sleep(0.5)
  34.     end
  35. end
  36.  
  37. function dig_down()
  38.     local success, data
  39.     while turtle.detectDown() do
  40.         success, data = turtle.inspectDown()
  41.         if success then
  42.             if (data.name ~= "computercraft:turtle_normal") and (data.name ~= "computercraft:turtle_advanced") then
  43.                 turtle.digDown()
  44.             else
  45.                 break
  46.             end
  47.         else
  48.             turtle.digDown()
  49.         end
  50.     sleep(0.5)
  51.     end
  52. end
  53.  
  54. for i = 1, dist do
  55.     dig_forward()
  56.     turtle.forward()
  57.     dig_down()
  58.     dig_up()
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement