Guest User

tunnel2

a guest
Sep 22nd, 2012
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.13 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. local filled = 0
  71.   for q = 3, 16 do
  72.      if turtle.getItemCount(q) >= 1 then
  73.     filled = filled + 1
  74.     end
  75.   end                                                                                                                                    
  76.  
  77.   if filled > 8 then
  78.    turtle.turnRight()
  79.    turtle.forward()  
  80.    turtle.turnRight()
  81.    for z = 1, times do
  82.      turtle.forward()
  83.    end
  84.    for t = 3, 16 do
  85.      turtle.select(t)
  86.      turtle.drop()
  87.    end
  88.    turtle.turnRight()
  89.    turtle.turnRight()
  90.    for w = 1, times do
  91.      turtle.forward()
  92.    end
  93.    turtle.turnLeft()
  94.    turtle.forward()
  95.    turtle.turnRight()
  96.   end
  97.  
  98. end
  99. --tunnel end
  100. turtle.turnRight()
  101. turtle.forward()
  102. turtle.turnLeft()
  103. print("And done")
  104. local fuelstate = turtle.getFuelLevel()
  105. print("I have "..fuelstate.." fuel")
  106.  
  107. if fuelstate < 1000 then
  108. print("Please refuel me")
  109. end
Advertisement
Add Comment
Please, Sign In to add comment