Advertisement
Guest User

tunnel

a guest
May 28th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. function refuel()
  2.   if turtle.getFuelLevel() < 200 then
  3.   turtle.select(1)
  4.   turtle.refuel(10)
  5.   print("Refueled")
  6.  else
  7.   print("Enough Fuel")
  8.  end
  9. end  
  10.  
  11. function mine()
  12.  while turtle.detect() do
  13.   turtle.dig()
  14.   sleep(0.5)
  15.  end
  16.  turtle.forward()
  17.  while turtle.detectUp() do
  18.   turtle.digUp()
  19.   sleep(0.5)
  20.  end
  21. end
  22.  
  23. function checkFull()
  24.  if turtle.getItemCount(16) > 0 then
  25.    turtle.digDown()
  26.    turtle.select(3)
  27.    turtle.placeDown()
  28.    print("Chest Placed")
  29.    for i = 5,16 do
  30.     turtle.select(i)
  31.     turtle.dropDown()
  32.    end
  33.    turtle.select(2)
  34.  end  
  35. end
  36.  
  37. function whole()
  38.  mine()
  39.  turtle.turnRight()
  40.  mine()
  41.  turtle.turnLeft()
  42.  mine()
  43.  turtle.turnLeft()
  44.  mine()
  45.  turtle.turnRight()
  46. end
  47.  
  48. function wholecheck()
  49.  checkFull()
  50.  whole()
  51. end
  52.  
  53. print("Welcome to the Tunneling Turtle interface")
  54. sleep(2)
  55. print("How long will the tunnel be?")
  56. local x = read()
  57.  
  58. refuel()
  59. sleep(0.5)
  60.  
  61. for i = 1,(x/2) do
  62.  wholecheck()
  63. end
  64.  
  65. print("Hope You Are Happy With Your Tunnel")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement