Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Todo
- -- - Get machine working!
- -- my libraries
- -- check dir exists, if not make it
- if not fs.exists("/libs") then--{{{
- fs.makeDir("/libs")
- end--}}}
- function update_lib(pastebin_id, dest_path)--{{{
- if fs.exists(dest_path) then
- fs.delete(dest_path)
- end
- shell.run("pastebin get " .. pastebin_id .. " " .. dest_path)
- os.loadAPI(dest_path)
- end--}}}
- update_lib("qUpykFN4", "libs/ccmisc")
- update_lib("n1S2GpfD", "libs/sorterAPI")
- -- clear library spam
- term.setCursorPos(1,1)
- term.clear()
- -- end my libraries
- --analyzer info:
- --output slots = 8,9,10,11
- --bee info:
- --ids = 13340,
- BeeBreeder = { analyzer = peripheral.wrap("left"), sorter = peripheral.wrap("interactiveSorter"), beeids = {13340,}, inputChestSide = 4, outputChestSide = 5, analyzerSide = 0, lyserSide = 3, apiarySide = 1 }
- function BeeBreeder:enoughHoney()--{{{
- local tankInfo = self.analyzer.getTanks("left")
- if tankInfo[1]["amount"] > 100 then
- return true
- else
- return false
- end
- end--}}}
- function BeeBreeder:analyzerHasSpace()--{{{
- local invSize = self.analyzer.getSizeInventory()
- for slot = 8,11 do
- local slotContents = self.analyzer.getStackInSlot(slot)
- if slotContents == nil then
- return true
- end
- end
- return false
- end--}}}
- function BeeBreeder:sort()
- for uuid,count in pairs(self.sorter.list(self.inputChestSide)) do
- item = sorterAPI.getID(uuid)
- if item[1] == 13340 then -- item is a bee
- -- check to see if it can be analysed
- print("Found bee")
- -- if can be analysed analyse the bloody thing
- elseif item[1] == 13286 or item[1] == 13289 or item[1] == 26098 then -- pollen
- print("Found pollen")
- elseif item[1] == 13288 then -- royal jelly
- print("Found royal jelly")
- else
- print("Found id: " .. tostring(item[1]) .. ":" .. tostring(item[2]))
- self:sendToOutput(uuid, count)
- end
- end
- end
- function BeeBreeder:sendToOutput(uuid, quantity)
- self.sorter.extract(self.inputChestSide, uuid, self.outputChestSide, quantity)
- end
- breeder = BeeBreeder
- breeder.analyzer = peripheral.wrap("left")
- breeder.sorter = peripheral.wrap("interactiveSorter_0")
- while true do
- -- wait for stuff to arrive in input box or timer to trigger
- event = os.pullEvent()
- -- examine each item in input chest
- breeder:sort()
- -- if comb, pollen or jelly, or string
- os.startTimer(30)
- end
- print(analyzerHasSpace(analyzer))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement