Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Using: CC: Tweaked, Plethora
- pastebin run VLMb0xUT
- pastebin get VLMb0xUT startup
- print(textutils.serialize(suggestions))
- ]]--
- apiaryName = "gendustry:industrial_apiary"
- samplerName = "gendustry:sampler"
- furnaceName = "xu2:tilemachinereceiver"
- apiary = peripheral.find(apiaryName)
- sampler = peripheral.find(samplerName)
- furnace = peripheral.find(furnaceName)
- beebeeUser = peripheral.find("redstone_integrator")
- function hasInSlot(slot, name)
- local pot = apiary.getItem(slot)
- if (pot == nil) then
- return false
- end
- return (string.find(pot.getMetadata().name, name) ~= nil)
- end
- function hasInOutput(name)
- local items = apiary.list()
- for i, item in pairs(items) do
- if(string.find(item.name, name) and i > 2) then
- return true
- end
- end
- return false
- end
- function handleQueen()
- beebeeUser.setOutput("down", true)
- os.sleep(1)
- beebeeUser.setOutput("down", false)
- end
- function handlePrincess()
- local items = apiary.list()
- for i, item in pairs(items) do
- if(string.find(item.name, "princess") and i > 2) then
- --print("Moving princess from slot: " .. i)
- apiary.pushItems("self", i)
- end
- end
- end
- function handleDrone()
- local items = apiary.list()
- for i, item in pairs(items) do
- if(string.find(item.name, "drone") and i > 2) then
- --print("Moving drone from slot: " .. i)
- apiary.pushItems("self", i, 1)
- end
- end
- end
- function handleExcessDrones()
- local items = apiary.list()
- for i, item in pairs(items) do
- if(string.find(item.name, "drone") and i > 2) then
- --print("Moving excess drone from slot: " .. i)
- apiary.pushItems(peripheral.getName(sampler), i)
- end
- end
- end
- function hasSpeciesSerum()
- local item = sampler.getItem(4)
- if(item == nil) then
- return nil
- end
- print("Got " .. item.getMetadata().displayName)
- return (string.find(item.getMetadata().displayName, "Species") ~= nil)
- end
- function hasLabware()
- local item = sampler.getItem(2)
- if(item == nil) then
- return nil
- end
- return (string.find(item.getMetadata().displayName, "Labware") ~= nil)
- end
- beebeeUser.setOutput("top", false)
- while(true) do
- if(hasInSlot(1, "queen")) then
- handleQueen()
- end
- if(hasInOutput("princess")) then
- handlePrincess()
- end
- if(not hasInSlot(2, "drone")) then
- handleDrone()
- end
- if(not hasLabware()) then
- print("No more labware!")
- do return end
- end
- if(hasSpeciesSerum()) then
- redstone.setOutput("top", true)
- print("Got Species serum!")
- do return end
- else
- sampler.pushItems(peripheral.getName(furnace), 4)
- end
- if(hasInOutput("drone")) then
- handleExcessDrones()
- end
- os.sleep(1)
- end
Add Comment
Please, Sign In to add comment