druidbruce

OC robot petal apothecary

Feb 26th, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local component = require("component")
  2. local sides = require("sides")
  3. local os = require("os")
  4. local robot = require("robot")
  5. local inv = component.inventory_controller
  6. local red = component.redstone
  7. local pulsetime = 0.25
  8.  
  9. local function pulse(PT)
  10.     red.setOutput(sides.back,15)
  11.     os.sleep(PT)
  12.     red.setOutput(sides.back,0)
  13. end
  14. local function dropcomparenot(slot,Target1,Target2)
  15.     robot.select(slot)
  16.     if not robot.compareTo(Target1) and not robot.compareTo(Target2) and robot.count(slot)>0 then
  17.             robot.dropDown()
  18.     end
  19. end
  20. local function dropcompare(slot, Target)
  21.     robot.select(slot)
  22.     if robot.compareTo(Target) then
  23.         robot.dropDown(1)
  24.     end
  25. end
  26. local function activate()
  27.     for i = 1, 14 do  --dropping seed
  28.         dropcompare(i,15)
  29.     end
  30. end
  31. while true do
  32.    
  33.     if robot.count(1) and robot.count(2) and robot.count(3) > 0 then
  34.         os.sleep(0.1)
  35.         for i = 1, 14 do  --dropping bucket
  36.             dropcompare(i,16)
  37.         end
  38.         for i = 1, 14 do  --use all items except seed and water bucket
  39.             dropcomparenot(i,14,15)
  40.         end
  41.  
  42.  
  43.         activate()
  44.         os.sleep(0.1)
  45.  
  46.         pulse(pulsetime)
  47.        
  48.     end
  49.     os.sleep(0.1)
  50.  
  51.  
  52. end
Add Comment
Please, Sign In to add comment