Advertisement
peptide

Turtle Farm

May 19th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. local waitTime = 20
  2.  
  3. function dropAll()
  4.     for x=1,16 do
  5.             turtle.select(x)
  6.             turtle.dropDown()
  7.         end
  8. end
  9.  
  10. function getFuel()
  11.     while (turtle.getFuelLevel() < 1000) do
  12.         turtle.select(1)
  13.         if turtle.suckUp() then
  14.             turtle.refuel()
  15.         else
  16.             print('No Fuel Found - Waiting 20 seconds')
  17.             os.sleep(20)
  18.         end
  19.         dropAll()
  20.     end
  21. end
  22.  
  23. while true do
  24.         turtle.digDown()
  25.  
  26.         turtle.forward()
  27.  
  28.         if turtle.detect() then
  29.  
  30.         if rs.getInput("front") then
  31.             dropAll()
  32.             getFuel()
  33.             sleep(waitTime)
  34.         end
  35.  
  36.             turtle.turnLeft()
  37.         end
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement