Advertisement
Guest User

breed

a guest
Jun 4th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.64 KB | None | 0 0
  1. -- Wrapping starting peripheral
  2. analyzer = peripheral.wrap("bottom")
  3. inventory = peripheral.wrap("right")
  4.  
  5. local p1 = nil
  6. local p2 = nil
  7. local done = false
  8.  
  9. -- checking on starting seeds
  10. local s1, s2, s3 = analyzer.getSpecimenStats("NORTH")
  11. p1 = s1 + s2 + s3
  12. local s1, s2, s3 = analyzer.getSpecimenStats("EAST")
  13. p2 = s1 + s2 + s3
  14.  
  15. while not done do
  16.   -- Check if parents are mature
  17.  
  18.   p1Mature = analyzer.isMature("EAST")
  19.   p2Mature = analyzer.isMature("NORTH")
  20.  
  21.   if p1Mature and p2Mature then
  22.     -- Place 2nd crop stick for crossbreeding
  23.     turtle.forward()
  24.     turtle.forward()
  25.     turtle.turnLeft()
  26.     turtle.forward()
  27.     redstone.setOutput("bottom", true)
  28.     sleep(1)
  29.     redstone.setOutput("bottom", false)
  30.    
  31.     -- Move to 2nd analyzer
  32.     turtle.forward()
  33.     turtle.turnLeft()
  34.     turtle.forward()
  35.     turtle.turnLeft()
  36.    
  37.     -- wait for crossbreed
  38.     analyzer = peripheral.wrap("bottom")
  39.     while analyzer.isCrossCrop("SOUTH") do
  40.       sleep(1)
  41.     end
  42.    
  43.     -- pick up new seed
  44.     turtle.forward()
  45.     turtle.select(1)
  46.     turtle.digDown()
  47.     turtle.suckDown()
  48.     turtle.placeDown()
  49.     turtle.select(2)
  50.     turtle.forward()
  51.     turtle.turnRight()
  52.     turtle.forward()
  53.     turtle.turnRight()
  54.     turtle.turnRight()
  55.     sleep(0.1)
  56.     print("Back at analyzer")
  57.     -- Analyze new seed
  58.     analyzer = peripheral.wrap("bottom")
  59.     --inventory.pushItem("down", 1)
  60.     turtle.dropDown(turtle.getItemCount())    
  61.     analyzer.analyze()
  62.     sleep(3.5)
  63.     turtle.select(2)
  64.     --inventory.pullItem("down", 1)
  65.     turtle.suckDown()
  66.    
  67.     print("seed analyzed")
  68.   end
  69.   sleep(5)
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement