Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- --change this to side where the apiary is
- inv = peripheral.wrap("bottom")
- --change this to side where output chest is
- chest = "right"
- --delay in seconds between checks
- sleeptime = 5
- --direction of output chest from apiary, (up, down, south, north etc)
- outputDir = "south"
- --direction of input chest from apiary
- inputDir = "north"
- --direction of hopper to reinsert bees into apiary
- hopperDir = "east"
- function errType(number)
- number = tonumber(number)
- if type(number) ~= "number" then
- return false
- else
- return true
- end
- end
- function getItem(slot)
- --check for integer
- if errType(slot) == false then
- return ""
- else
- if inv ~= nil then
- item = inv.getStackInSlot(slot)
- if item ~= nil then
- return item["name"]
- else
- return ""
- end
- end
- end
- end
- function inStr(query,word)
- res = string.find(word,query)
- if res ~= nil then
- return true
- else
- return false
- end
- end
- --Display some stats
- print ("Apiary current inventory:")
- for i=1,9 do
- item = getItem(i)
- if item ~= "" then print (i.." "..item) end
- end
- --Check if queenin'
- while inStr("Queen",getItem(1)) do
- print("Queen is working... waiting")
- os.sleep(sleeptime)
- end
- --Go empty out produce
- for i=3,9 do
- item = getItem(i)
- if inStr("Comb",item) then
- inv.pushItem(outputDir,i)
- --Re-Run any princesses
- --elseif inStr("Princess",item) then
- -- inv.pushItem(hopperDir,i,64)
- --Re-Run any drones
- elseif inStr("Drone",item) then
- inv.pushItem(outputDir,i)
- end
- end
- --Remove possible drones from last cycle
- --if inStr("Drone",getItem(2) then
- print(inv.pushItem(outputDir,2))
- --end
- --Look for princesses...
- for i=3,9 do
- item = getItem(i)
- if inStr("Princess",item) then
- if inStr("Forest",item) then
- end
- end
- end
- --while true do
- print("~Fin")
- --end
- --print(getName(inv,args[1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement