Niseg

follow floor miner

Apr 22nd, 2013
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. local sel=1
  2. turtle.select(sel)
  3. local curcount=turtle.getItemCount(sel)
  4. local prvcount=curcount
  5. local temp
  6. local toggle=true
  7. print("Follow floor miner by Niseg(for Nixaro)")
  8. print("turns right first; follow identical blocks")
  9. print("pre-refuel at least 1 per block not more")
  10. print("identify liquid,climbs mountains(careful!)")
  11. print("hold CTRL-T to stop")
  12. while true do
  13.     if(turtle.digDown()) then
  14.         temp=turtle.getItemCount(sel+1)
  15.         curcount=turtle.getItemCount(sel)
  16.         if temp~=0 then
  17.             if turtle.compareTo(sel+1) then
  18.                 sel=sel+1
  19.                 turtle.select(sel)
  20.                 while not turtle.forward() do turtle.up() end
  21.             else
  22.                 turtle.select(sel+1)
  23.                 turtle.drop()
  24.                 turtle.select(sel)
  25.                 turtle.back()
  26.                 if toggle then turtle.turnRight() else turtle.turnLeft() end
  27.                 while not turtle.forward() do turtle.up() end
  28.                 if toggle then turtle.turnRight() else turtle.turnLeft() end
  29.                 toggle=not toggle
  30.  
  31.             end
  32.         else
  33.             if prvcount==curcount then  
  34.                 turtle.back()
  35.                 if toggle then turtle.turnRight() else turtle.turnLeft() end
  36.                 while not turtle.forward() do turtle.up() end
  37.                 if toggle then turtle.turnRight() else turtle.turnLeft() end
  38.                 toggle=not toggle
  39.             else
  40.                 while not turtle.forward() do turtle.up() end
  41.             end
  42.  
  43.         end
  44.         prvcount=curcount
  45.     else
  46.     turtle.down()
  47.     end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment