Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. start = vector.new(1097,47,1092)
  2. pos = vector.new(gps.locate(5))
  3. args = {...}
  4. ud = args[0]
  5. lr = args[1]
  6. crops = {}
  7. crops["magicalcrops:MinicioCrop"] = "magicalcrops:MinicioSeeds"
  8. crops["magicalcrops:CoalCrop"] = "magicalcrops:CoalSeeds"
  9. face = "s"
  10. --Default
  11. ud = 12
  12. lr = 24
  13.  
  14. function goHome()
  15.  
  16. print("x: ",pos.x)
  17. print("z: ",pos.z)
  18.  
  19. if face == 's' then
  20. turtle.turnRight()
  21. turtle.turnRight()
  22. end
  23.  
  24. for i=1,pos.x do
  25. turtle.forward()
  26. end
  27.  
  28. turtle.turnRight()
  29. for i=1, pos.z do
  30. turtle.forward()
  31. end
  32. turtle.turnRight()
  33.  
  34. turtle.down();
  35. face = "s"
  36. end
  37.  
  38. function nextRow()
  39. if face == "s" then
  40. turtle.turnRight()
  41. turtle.forward()
  42. pos.z = pos.z + 1
  43. turtle.turnRight()
  44. face = "n"
  45. else
  46. turtle.turnLeft()
  47. turtle.forward()
  48. pos.z = pos.z + 1
  49. turtle.turnLeft()
  50. face = "s"
  51. end
  52. end
  53.  
  54. function checkCrop()
  55. local success, data = turtle.inspectDown()
  56.  
  57. if success then
  58. if data.metadata == 7 then
  59. print("Grown Crop")
  60. turtle.digDown()
  61. for i=1,16 do
  62. seed = crops[data.name]
  63. print("i: ",i)
  64. if turtle.getItemDetail(i) ~= nil then
  65. if(seed == turtle.getItemDetail(i).name) then
  66. print("Found Seed")
  67. turtle.select(i)
  68. turtle.placeDown()
  69. end
  70. end
  71. end
  72. else
  73. print("Crop Still Growing: ",data.metadata)
  74. end
  75. end
  76. return 0
  77. end
  78.  
  79. --Start
  80. turtle.up()
  81.  
  82. for d=0,lr do
  83. for i=0,ud do
  84. turtle.forward()
  85. if face == "s" then
  86. pos.x = pos.x + 1
  87. else
  88. pos.x = pos.x - 1
  89. end
  90. checkCrop()
  91. end
  92. nextRow()
  93. checkCrop()
  94. end
  95.  
  96. goHome()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement