Advertisement
peptide

Stripmine

Aug 26th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. --Stripmine
  2. --This sends a turtle down to bedrock mineing below and infront as it goes down.
  3. --It then moves forward 2
  4. --and mines back up to the same level
  5. --This will create a 1X4 hole to bedrock
  6.  
  7. function fuel()
  8.  
  9.     while turtle.getFuelLevel() < 500 do
  10.         print("Looking for Fuel")
  11.             for slot = 1,16 do
  12.             if turtle.getFuelLevel() < 500 then
  13.                         turtle.select(slot)
  14.                             repeat
  15.                             until turtle.refuel(1) == false or turtle.getFuelLevel() > 500
  16.                     end
  17.             end
  18.     end
  19. end
  20.  
  21. function digdown()
  22.     local distance = 0
  23.     repeat
  24.         distance = distance + 1
  25.         turtle.suck()
  26.         turtle.dig()
  27.                 turtle.suckDown()
  28.                 turtle.digDown()
  29.         until turtle.down() == false
  30.     return distance
  31. end
  32.  
  33. function moveforward(distance)
  34.     repeat
  35.         turtle.dig()
  36.         if turtle.forward() then
  37.             distance= distance - 1
  38.         else
  39.             turtle.digUp()
  40.             turtle.up()
  41.         end
  42.     until distance== 0
  43. end
  44.  
  45. function digup(distance)
  46.     repeat
  47.         distance= distance - 1
  48.         turtle.suck()
  49.         turtle.dig()
  50.                 turtle.digUp()
  51.         turtle.up()
  52.         until distance <= 1
  53. end
  54.  
  55. function freeslots()
  56.     local free = 0
  57.     for slot = 1,16 do
  58.                 turtle.select(slot)
  59.         if turtle.getItemCount == 0 then
  60.             free = free + 1
  61.         end
  62.         end
  63.     return free
  64. end
  65.  
  66. local depth
  67.  
  68. repeat
  69.     fuel()
  70.     depth = digdown()
  71.     moveforward(2)
  72.     digup(depth)
  73.     moveforward(2)
  74. until freeslots() < 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement