akihex

oldFlowersAndBees

Apr 21st, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local interfaceDir = "down"
  2. local beeDir = {"front", "right", "back", "left"}
  3. local bee = {}
  4.  
  5. for i=1,4 do
  6.   bee[i] = peripheral.wrap(beeDir[i])
  7. end
  8.  
  9. -- pull princess and drone from interface
  10. local function fillApiary(apiary)
  11.   local result = 0
  12.   -- princess in slot 1 in apiary and interface
  13.   result = apiary.pullItemIntoSlot(interfaceDir, 1, 1, 1)
  14.   if result==0 then result=apiary.pullItemIntoSlot(interfaceDir,3,1,1) end
  15.   -- drone in slot 2
  16.   result = result * apiary.pullItemIntoSlot(interfaceDir, 2, 1, 2)
  17.   if result==1 then return true
  18.   else return false end
  19. end
  20.  
  21. --local function checkQueen(apiary)
  22. --  local queen = apiary.getQueen()
  23. --  return queen
  24. --end
  25.  
  26. local function getApiaryProducts(apiary)
  27.   local result = 0
  28.   for i=3,9 do
  29.     result = result + apiary.pushItem(interfaceDir,i,64)
  30.   end
  31.   return result
  32. end
  33.  
  34. -- main :)
  35. local fill = true
  36. while true do
  37.   for i=1,4 do
  38.     --check apiaries
  39.     if not bee[i].getQueen() then
  40.       print(getApiaryProducts(bee[i]))
  41.       fill = fillApiary(bee[i])
  42.       if not fill then break end
  43.     end
  44.   end
  45.   if not fill then break end
  46.   sleep(5)
  47. end
Advertisement
Add Comment
Please, Sign In to add comment