CoolisTheName007

wheat

Mar 17th, 2013
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. args={...}
  2. delay=tonumber(args[1] or 1200)
  3.  
  4. function ensureFuel()
  5.     while turtle.getFuelLevel()==0 do
  6.         shell.run'refuel all'
  7.         sleep(10)
  8.     end
  9. end
  10.  
  11. function go(action)
  12.     ensureFuel()
  13.     i=0
  14.     while action() do
  15.         i=i+1
  16.         turtle.select(1)
  17.         turtle.digDown()
  18.         turtle.select(16)
  19.         turtle.placeDown()
  20.         sleep(1)
  21.     end
  22.     return i
  23. end
  24.  
  25. local i
  26. while true do
  27.     i=go(turtle.forward)
  28.     turtle.select(1)
  29.     turtle.drop()
  30.     turtle.select(16)
  31.     turtle.drop(math.min(turtle.getItemCount(16)-i,0))
  32.     sleep(delay)
  33.     i=go(turtle.back)
  34. end
Advertisement
Add Comment
Please, Sign In to add comment