Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mg = peripheral.wrap("left")
- rednet.open("right")
- function doBee(slot)
- local state
- while true do
- print ("Placing bee...")
- turtle.select(slot)
- turtle.drop()
- print ("Getting serum...")
- turtle.select(16)
- turtle.turnLeft()
- gotOne = turtle.suck()
- turtle.turnRight()
- if (gotOne == false) then
- print ("No more serums")
- turtle.select(slot)
- turtle.suck()
- break
- else
- print ("Got one")
- end
- print ("Inserting serum...")
- x = turtle.drop()
- print (tostring(x))
- print ("Waiting for the machine to start...")
- sleep(5)
- repeat
- sleep(5)
- print ("Waiting for the machine to finish...")
- state = mg.get()
- until (state["Is Not Working"] and state["Energy Stored"])
- print ("Getting the bee back...")
- turtle.select(slot)
- turtle.suck()
- print ("Removing the serum...")
- turtle.select(16)
- turtle.suck()
- print ("Sending the serum back...")
- turtle.turnRight()
- turtle.drop()
- turtle.turnLeft()
- print ("End iteration")
- end
- end
- rs.setBundledOutput("top", colors.red)
- for i=1,15 do
- if (turtle.getItemCount(i) > 0) then
- print ("Processing bee in slot #"..tostring(i))
- doBee(i)
- print ("Asking for a refill...")
- rednet.broadcast("Refill")
- print ("Waiting for a refill...")
- repeat
- id, msg, dist = rednet.receive()
- until (msg == "Inoculate")
- print ("Done with this bee")
- end
- end
- rs.setBundledOutput("top", colors.green)
Advertisement
Add Comment
Please, Sign In to add comment