Advertisement
Guest User

StripMine()

a guest
Jul 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. local fuel = 1
  2. local tunnelLength = 64
  3. local turnRight = 0
  4. function turtle.detectGravel()
  5.   os.sleep(0.1)
  6.   while turtle.detect() do
  7.     turtle.dig()
  8.     os.sleep(0.1)
  9.   end
  10. end
  11.  
  12. function turtle.checkFuel()
  13.   while turtle.getFuelLevel() < 200 do
  14.     turtle.select(1)
  15.     refuelAmount = turtle.getItemCount(1) -1
  16.     turtle.refuel(refuelAmount)
  17.   end
  18.   print("refueled")
  19. end  
  20.  
  21. print("put fuel in slot 1, torches in slot 2.")
  22. print("Go right = 0, Go left = 1")
  23. turnRight = tonumber(read())
  24. print("tunnel length?")
  25. tunnelLength = tonumber(read())
  26.  
  27. while true do
  28. for i = 1, tunnelLength do
  29.     turtle.checkFuel()
  30.     turtle.dig()
  31.     turtle.detectGravel()
  32.     if i % 10 == 0 then
  33.       turtle.turnLeft()
  34.       turtle.turnLeft()
  35.       turtle.select(2)
  36.       turtle.place()
  37.       turtle.turnRight()
  38.       turtle.turnRight()
  39.     end
  40.     turtle.forward()
  41.     turtle.digUp()
  42.   end
  43.   if turnRight == 0 then
  44.     turtle.turnRight()
  45.     turtle.dig()
  46.     turtle.forward()
  47.     turtle.digUp()
  48.     turtle.dig()
  49.     turtle.forward()
  50.     turtle.digUp()
  51.     turtle.dig()
  52.     turtle.forward()
  53.     turtle.digUp()
  54.     turtle.turnRight()
  55.     turnRight = 1
  56.   else
  57.     turtle.turnLeft()
  58.     turtle.dig()
  59.     turtle.forward()
  60.     turtle.digUp()
  61.     turtle.dig()
  62.     turtle.forward()
  63.     turtle.digUp()
  64.     turtle.dig()
  65.     turtle.forward()
  66.     turtle.digUp()
  67.     turtle.turnLeft()
  68.     turnRight = 0
  69.   end
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement