Advertisement
ThugDio

digTunnel

Feb 10th, 2017 (edited)
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local digTunnelModule = {}
  2. function digTunnelModule.digIt()
  3.   print("Quantos blocos? (num)")
  4.   hM = tonumber(read())
  5.   print("Retornar ao final? (s/n)")
  6.   retYN = read()
  7.   print("Colocar tochas? (s/n)")
  8.   putTorch = read()
  9.   torchDist = 4
  10.   torchCount = 0
  11.   count = 0
  12.  
  13.   while (count < hM) do
  14.     while turtle.dig() do
  15.       sleep(0.5)
  16.     end
  17.     if (turtle.forward()) then
  18.       count = count + 1
  19.       torchCount = torchCount + 1
  20.     end
  21.     while turtle.digUp() do
  22.       sleep(0.5)
  23.     end
  24.     turtle.up()
  25.     while turtle.digUp() do
  26.       sleep(0.5)
  27.     end
  28.     if (torchCount == torchDist) and (putTorch == 's') then
  29.       turtle.turnLeft()
  30.       turtle.turnLeft()
  31.       turtle.place()
  32.       turtle.turnLeft()
  33.       turtle.turnLeft()
  34.       torchCount = 0
  35.     end
  36.     turtle.down()
  37.   end
  38.  
  39.   count = 0
  40.   if (retYN == 's') then
  41.     turtle.turnLeft()
  42.     turtle.turnLeft()
  43.     while (count < hM) do
  44.       if (turtle.forward()) then
  45.         count = count + 1
  46.       end
  47.     end
  48.   end
  49. end
  50.  
  51. return digTunnelModule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement