Advertisement
Guest User

Farm

a guest
Jul 21st, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. --Plant
  2.  function plant()
  3.  if turtle.getItemCount(1) == 0 then
  4.  turtle.select(1)
  5.  turtle.turnLeft()
  6.  turtle.suck()
  7.  turtle.turnRight()
  8.  end
  9.  if turtle.getItemCount(2) == 0 then
  10.  turtle.select(2)
  11.  turtle.turnRight()
  12.  turtle.suck()
  13.  turtle.turnLeft()
  14.  end
  15.  turtle.select(1)
  16.  turtle.place()
  17.  turtle.select(2)
  18.  turtle.place()
  19.  sleep(6)
  20. end
  21.  
  22. --Chop
  23. function chop()
  24. turtle.select(3)
  25. turtle.dig()
  26. turtle.forward()
  27. while turtle.compareUp() == true do
  28. turtle.digUp()
  29. turtle.up()
  30. end
  31. while turtle.detectDown() == false do
  32. turtle.down()
  33. end
  34. turtle.back()
  35. end
  36.  
  37. --Refuel
  38. function refuel()
  39. turtle.select(3)
  40. turtle.refuel(1)
  41. sleep(0.5)
  42. end
  43.  
  44. --Empty
  45. function empty()
  46. turtle.turnLeft()
  47. turtle.turnLeft()
  48. turtle.select(3)
  49. turtle.drop()
  50. turtle.turnRight()
  51. turtle.turnRight()
  52. end
  53.  
  54. while true do
  55. refuel()
  56. empty()
  57. plant()
  58. chop()
  59. sleep(5)
  60. os.queueEvent("Repeat")
  61. os.pullEvent()
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement