Guest User

mine

a guest
May 4th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. function fuel()
  2.   if turtle.getFuelLevel() <= 50 then
  3.     turtle.select(16)
  4.     turtle.refuel(1)
  5.   end
  6. end
  7.  
  8. function isValuable()
  9.   local isJunk = false
  10.   for i=1,4 do
  11.     turtle.select(i)
  12.     if turtle.detect() or turtle.compare() then
  13.       isJunk = true  
  14.     end
  15.   end
  16.   if isJunk then
  17.     return false
  18.   else
  19.     return true
  20.   end  
  21. end
  22. function checkWalls()
  23.   for j=1,4 do
  24.     if isValuable() then
  25.       turtle.dig()
  26.     end
  27.     turtle.turnRight()  
  28.   end
  29. end
  30.  
  31. -- ( Program Start ) --
  32.  
  33. local depth = 0  
  34.  
  35. fuel()
  36. turtle.digDown()
  37.  
  38. while turtle.detectDown() == false do
  39.   fuel()
  40.   turtle.down()
  41.   depth = depth + 1
  42.   checkWalls()  
  43.   turtle.digDown()
  44. end
  45.  
  46. for k = 1,depth do
  47.   fuel()
  48.   turtle.up()
  49. end
Advertisement
Add Comment
Please, Sign In to add comment