Advertisement
denvys5

Farmer

Jan 8th, 2014
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. local tArgs = {...}
  2.  
  3. local t=turtle
  4. if tArgs == 0 then
  5.  tArgs[1] = 12 -- inactive now, doesn`t working, may work
  6.  tArgs[2] = 120 -- inactive now, doesn`t working, may work
  7. end
  8.  
  9. function refuel()
  10.  t.select(16)
  11.   while t.getFuelLevel()<100 do
  12.     if not turtle.refuel(1) then
  13.       print("Put fuel in slot 16")
  14.       os.sleep(10)
  15.     end
  16.   end
  17. end
  18.  
  19. function cleaninv()
  20.  for i=1,15 do
  21.   t.select(i)
  22.   t.drop()
  23.  end
  24.  t.select(1)
  25. end
  26.  
  27. function suck()
  28.  t.turnRight()
  29.  t.suck()
  30.  t.suckUp()
  31.  t.turnLeft()
  32.  t.suck()
  33.  t.suckUp()
  34.  t.turnLeft()
  35.  t.suck()
  36.  t.suckUp()
  37.  t.turnRight()
  38. end
  39.  
  40. function move(tArgs[1])
  41.  for i=1,tArgs[1] do
  42.   suck()
  43.   refuel()
  44.   t.forward()
  45.  end
  46. end
  47.  
  48. function turnBack()
  49.  t.turnRight()
  50.  t.turnRight()
  51. end
  52.  
  53. function main(tArgs[1], tArgs[2])
  54. while true do
  55.  move(tArgs[1])
  56.  turnBack()
  57.  move()
  58.  cleaninv()
  59.  turnBack()
  60.  sleep(tArgs[2])
  61. end
  62. end
  63.  
  64. main(tArgs[1], tArgs[2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement