Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 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.  
  15.  
  16.  
  17. function clearInventory()
  18. print("Clearing Inventory...")
  19. for i=1,15 do
  20. turtle.select(i)
  21. turtle.dropDown()
  22. end
  23. end
  24.  
  25. function goHome()
  26. print("x: ",pos.x)
  27. print("z: ",pos.z)
  28.  
  29. if face == 's' then
  30. turtle.turnRight()
  31. turtle.turnRight()
  32. end
  33.  
  34. for i=1,pos.x do
  35. turtle.forward()
  36. end
  37.  
  38. turtle.turnRight()
  39. for i=1, pos.z do
  40. turtle.forward()
  41. end
  42. turtle.turnRight()
  43.  
  44. turtle.down();
  45. face = "s"
  46. end
  47.  
  48. function nextRow()
  49. if face == "s" then
  50. turtle.turnRight()
  51. turtle.forward()
  52. pos.z = pos.z + 1
  53. turtle.turnRight()
  54. face = "n"
  55. else
  56. turtle.turnLeft()
  57. turtle.forward()
  58. pos.z = pos.z + 1
  59. turtle.turnLeft()
  60. face = "s"
  61. end
  62. end
  63.  
  64. function checkCrop()
  65. local success, data = turtle.inspectDown()
  66.  
  67. if success then
  68. if data.metadata == 7 then
  69. print("Grown Crop")
  70. turtle.digDown()
  71. for i=1,16 do
  72. seed = crops[data.name]
  73. print("i: ",i)
  74. if turtle.getItemDetail(i) ~= nil then
  75. if(seed == turtle.getItemDetail(i).name) then
  76. print("Found Seed")
  77. turtle.select(i)
  78. turtle.placeDown()
  79. turtle.select(1)
  80. end
  81. end
  82. end
  83. else
  84. print("Crop Still Growing: ",data.metadata)
  85. end
  86. end
  87. return 0
  88. end
  89.  
  90. --Start
  91. turtle.up()
  92.  
  93. for d=0,lr do
  94. for i=0,ud do
  95. turtle.forward()
  96. if face == "s" then
  97. pos.x = pos.x + 1
  98. else
  99. pos.x = pos.x - 1
  100. end
  101. checkCrop()
  102. end
  103. nextRow()
  104. checkCrop()
  105. end
  106.  
  107. goHome()
  108. clearInventory()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement