Hiranus

BeeBreeder

Jul 19th, 2015
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. local chest = peripheral.wrap("tileskychest_0")
  2. local apiary = peripheral.wrap("right")
  3. local pattern = peripheral.wrap("left")
  4. local species = nil
  5. function IsApiaryDone()
  6.     if apiary.getAllStacks()[1] == nil then
  7.         return true
  8.     else
  9.         return false
  10.     end
  11. end
  12. function Split(inputstr, sep)
  13.         if sep == nil then
  14.                 sep = "%s"
  15.         end
  16.         local t={} ; i=1
  17.         for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  18.                 t[i] = str
  19.                 i = i + 1
  20.         end
  21.         return t
  22. end
  23. function GetSpecies ()
  24.     bee = pattern.getAllStacks()
  25.     if bee[1] == nil then
  26.         printError("No species bee")
  27.         error()
  28.     end
  29.     species = Split(bee[1].basic().display_name," ")[1]
  30. end
  31.  
  32. function findWrongPrincess ()
  33.     bee = chest.getAllStacks()
  34.     for k,v in pairs(bee) do
  35.         if v.basic().id == "Forestry:beePrincessGE" then
  36.             if species ~= Split(v.basic().display_name," ")[1] then
  37.                 chest.pushItem("west",k)
  38.                 return
  39.             end
  40.         end
  41.     end
  42.     printError("No princess to work with")
  43.     error()
  44. end
  45.  
  46. GetSpecies()
  47. while true do
  48.     sleep(1)
  49.     if (IsApiaryDone()) then
  50.         findWrongPrincess ()
  51.     end
  52. end
Advertisement
Add Comment
Please, Sign In to add comment