MCPaule

Untitled

Sep 21st, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. function refuel()
  2. if turtle.getFuelLevel() == 0 then
  3. turtle.select(1)
  4. turtle.refuel(1)
  5. print("refueling")
  6. end
  7. end
  8.  
  9. function plant()
  10. turtle.select(2)
  11. turtle.placeDown()
  12. end
  13.  
  14. function harvest()
  15. turtle.digDown()
  16. end
  17.  
  18. function prepare()
  19. turtle.attackDown()
  20. end
  21.  
  22. function turnLeft()
  23. turtle.turnLeft()
  24. turtle.forward()
  25. turtle.turnLeft()
  26. end
  27.  
  28. function turnRight()
  29. turtle.turnRight()
  30. turtle.forward()
  31. turtle.turnRight()
  32. end
  33.  
  34. function doWork()
  35. for i=1,7 do
  36. if turtle.getFuelLevel() < 10 then
  37. refuel()
  38. end
  39. harvest()
  40. prepare()
  41. plant()
  42. turtle.forward()
  43. end
  44. harvest()
  45. prepare()
  46. plant()
  47. end
  48.  
  49. function work()
  50. turtle.turnRight()
  51. for j=1,3 do
  52. for i=1,4 do
  53. doWork()
  54. turnLeft()
  55. doWork()
  56. turnRight()
  57. end
  58. turtle.up()
  59. turtle.turnLeft()
  60. turtle.forward()
  61. turtle.turnRight()
  62. end
  63. end
  64.  
  65. function main()
  66. print("Starting")
  67. refuel()
  68. turtle.up()
  69. turtle.up()
  70. turtle.forward()
  71. turtle.forward()
  72. work()
  73. print("end")
  74. end
  75.  
  76.  
  77. main()
Advertisement
Add Comment
Please, Sign In to add comment