Advertisement
Guest User

Untitled

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