Guest User

tunnel2

a guest
Sep 22nd, 2012
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. print("This program digs tunnel 3x3") --and even put every 5 blocks torch on wall
  2. print("Important ! place torches in slot 1 and solid block to slot 2 !")
  3. print("How long tunnel do you want ? ")
  4. local x = read()
  5. local times = 0
  6. print("Digging "..x.." blocks long tunnel")
  7. turtle.turnLeft()
  8. while not turtle.forward() do
  9.   turtle.dig()
  10. end
  11. turtle.turnRight()
  12.  
  13.  
  14. for i = 1, x do
  15.  
  16.   while not turtle.forward() do
  17.     turtle.dig()
  18.   end
  19.  
  20.   turtle.turnRight()
  21.  
  22.  for j = 1, 2 do  
  23.   for i = 1, 2 do    
  24.     while not turtle.forward() do
  25.       turtle.dig()
  26.     end
  27.   end  
  28.   turtle.turnLeft()
  29.   turtle.turnLeft()
  30.   while not turtle.up() do
  31.     turtle.digUp()
  32.   end  
  33.  end  
  34.  
  35.  for k = 1, 2 do
  36.    while not turtle.forward() do
  37.     turtle.dig()
  38.    end
  39.  end
  40.  
  41.  turtle.turnLeft()
  42.  turtle.turnLeft()
  43.  turtle.down()
  44. if math.fmod(times,5) == 0 then
  45.   for u = 1, 2 do
  46.    while not turtle.forward() do
  47.      turtle.dig()
  48.    end
  49.   end
  50.  if not turtle.detect() then
  51.   turtle.select(2)
  52.   turtle.place()
  53.  end
  54.   turtle.select(1)
  55.   turtle.back()
  56.   turtle.place()
  57.   turtle.down()
  58.   turtle.forward()
  59.    
  60. else  
  61.  turtle.down()
  62.  for l = 1, 2 do
  63.    while not turtle.forward() do
  64.      turtle.dig()
  65.    end
  66.  end
  67. end  
  68.  turtle.turnRight()
  69. times = times + 1                                                                  
  70. end
  71. turtle.turnRight()
  72. turtle.forward()
  73. turtle.turnLeft()
  74. print("And done")
  75. local fuelstate = turtle.getFuelLevel()
  76. print("I have "..fuelstate.." fuel")
  77.  
  78. if fuelstate < 1000 then
  79. print("Please refuel me")
  80. end
Advertisement
Add Comment
Please, Sign In to add comment