Advertisement
Guest User

bee

a guest
Oct 25th, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.93 KB | None | 0 0
  1. args = {...}
  2. --change this to side where the apiary is
  3. inv = peripheral.wrap("bottom")
  4. --change this to side where output chest is
  5. chest = "right"
  6. --delay in seconds between checks
  7. sleeptime = 5
  8. --direction of output chest from apiary, (up, down, south, north etc)
  9. outputDir = "south"
  10. --direction of input chest from apiary
  11. inputDir = "north"
  12. --direction of hopper to reinsert bees into apiary
  13. hopperDir = "east"
  14.  
  15. function errType(number)
  16.   number = tonumber(number)
  17.   if type(number) ~= "number" then
  18.     return false
  19.   else
  20.     return true
  21.   end
  22. end
  23.  
  24. function getItem(slot)
  25.   --check for integer
  26.   if errType(slot) == false then
  27.     return ""
  28.   else
  29.     if inv ~= nil then
  30.       item = inv.getStackInSlot(slot)
  31.       if item ~= nil then
  32.         return item["name"]
  33.       else
  34.         return ""
  35.       end
  36.     end
  37.   end
  38. end
  39.  
  40. function inStr(query,word)
  41.   res = string.find(word,query)
  42.   if res ~= nil then
  43.     return true
  44.   else
  45.     return false
  46.  end
  47. end
  48.  
  49. --Display some stats
  50. print ("Apiary current inventory:")
  51. for i=1,9 do
  52.   item = getItem(i)
  53.   if item ~= "" then print (i.." "..item) end
  54. end
  55.  
  56. --Check if queenin'
  57. while inStr("Queen",getItem(1)) do
  58.   print("Queen is working... waiting")
  59.   os.sleep(sleeptime)
  60. end
  61.  
  62.  
  63.  
  64. --Go empty out produce
  65. for i=3,9 do
  66.   item = getItem(i)
  67.  
  68.   if inStr("Comb",item) then
  69.     inv.pushItem(outputDir,i)
  70.   --Re-Run any princesses
  71.   --elseif inStr("Princess",item) then
  72.   --  inv.pushItem(hopperDir,i,64)
  73.   --Re-Run any drones
  74.   elseif inStr("Drone",item) then
  75.     inv.pushItem(outputDir,i)
  76.   end
  77. end
  78.  
  79. --Remove possible drones from last cycle
  80. --if inStr("Drone",getItem(2) then
  81. print(inv.pushItem(outputDir,2))
  82. --end
  83.  
  84. --Look for princesses...
  85. for i=3,9 do
  86.   item = getItem(i)
  87.   if inStr("Princess",item) then
  88.     if inStr("Forest",item) then
  89.      
  90.     end
  91.   end
  92.    
  93. end
  94.  
  95.  
  96.  
  97. --while true do
  98. print("~Fin")
  99. --end
  100.  
  101. --print(getName(inv,args[1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement