Advertisement
Guest User

testwell

a guest
Jan 24th, 2015
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. function goUp(c)
  2.   for up=1,c do
  3.     if turtle.detect() then
  4.       turtle.digUp()
  5.     end
  6.     turtle.up()
  7.   end
  8. end
  9.  
  10. function compareTo()
  11.   if turtle.detect() then
  12.     for i=1,3 do
  13.       turtle.select(i)
  14.       if turtle.compare() then
  15.         return false
  16.       end
  17.     end
  18.     return true
  19.   end
  20. end
  21.  
  22. function compareDown()
  23.   if turtle.detectDown() then
  24.     for j=1,3 do
  25.       turtle.select(j)
  26.       if turtle.compareDown() then
  27.         return false
  28.       end
  29.     end
  30.     return true
  31.   end
  32. end
  33.  
  34. function lookAround()
  35.   for turn=1,4 do
  36.     local oreFound = compareTo()
  37.     if oreFound then
  38.       turtle.dig()
  39.     end
  40.     turtle.turnLeft()
  41.     turtle.select(1)
  42.   end
  43. end
  44.  
  45. function digWell()
  46.   for dig=1,8 do
  47.     lookAround()
  48.     if turtle.detectDown() then
  49.       turtle.digDown()
  50.     end
  51.     turtle.down()
  52.   end
  53.   local oreDown = compareDown()
  54.   if oreDown then
  55.     turtle.digDown()
  56.   end
  57.   goUp(8)
  58. end
  59.  
  60. digWell()
  61. --lookAround()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement