DiabolusNeil

Untitled

Oct 3rd, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. -- Turtle Cave Detector
  2. -- Written by DiabolusNeil | CC 1.56
  3. -- Requires: Mining Turtle
  4.  
  5. local bool = false
  6. if turtle.detectDown() == false then
  7.   while turtle.detectDown() == false do
  8.     turtle.down()
  9.   end
  10. end
  11.  
  12. if turtle.digDown() == false and turtle.detectDown() == true then
  13.   print("Turtle cannot dig down!")
  14. else
  15.   local num1
  16.   local total = 0
  17.   for i = 1, 16 do 
  18.     turtle.select(i)
  19.     num1 = turtle.getItemCount()
  20.     total = total + num1
  21.   end
  22.   if total ~= 0 then
  23.     print("Clear the turtle's inventory!")
  24.   else
  25.     print("All ready to go! Excavating...")
  26.     bool = true
  27.   end
  28. end
  29.  
  30. if bool then
  31.   local level = 0
  32.   while turtle.digDown() do
  33.     turtle.digDown()
  34.     level = level + 1
  35.   end
  36.   if turtle.detectDown() == true then
  37.     for i = 1, level do
  38.       turtle.up()
  39.     end
  40.     print("No cave detected below.")
  41.   elseif turtle.detectDown() == false then
  42.     for i = 1, level do
  43.       turtle.up()
  44.     end
  45.     print("A cave has been detected!")
  46.   end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment