Advertisement
Guest User

Untitled

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