Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bio = peripheral.wrap("back")
- local modem = peripheral.wrap("bottom")
- local machine = "tile_mfr_machine_bioreactor_name_0"
- function getSecondStack(stack)
- return modem.callRemote(machine,"getStackInSlot",stack)
- end
- function isIn(var,tab)
- for i,v in ipairs(tab) do
- if ( v == var ) then return true end
- end
- return false
- end
- function PushItem(slot)
- bio.pushItem("north",slot)
- end
- function checkSecond()
- local count = 0
- for i = 1,9 do
- if ( getSecondStack(i) ~= nil ) then count = count + 1 end
- end
- if ( count >= 6 ) then return false end
- count = 0
- for i=10,18 do
- if ( getSecondStack(i) ~= nil ) then count = count + 1 end
- end
- if ( count >= 8 ) then return false end
- return true
- end
- while true do
- local idList = {}
- local numOfTypes = 0
- -- print("wee")
- for i=1,9 do
- local item = bio.getStackInSlot(i)
- if ( item ~= nil ) then
- local code = item.id .. "." .. item.dmg
- if ( isIn(code,idList) ) then
- -- print("Pushing " .. i .. " " .. item.id)
- PushItem(i)
- else
- -- print("Adding " .. i .. " ".. item.id)
- table.insert(idList,code)
- end
- end
- end
- for i=10,18 do
- local item = bio.getStackInSlot(i)
- if ( item ~= nil ) then numOfTypes = numOfTypes + 1 end
- end
- local first = true
- local second = checkSecond()
- if ( numOfTypes >= 8 ) then
- first = false
- --rs.setAnalogOutput("right",true)
- else
- first = true
- --rs.setOutput("right",false)
- end
- local color = 0
- if ( first ) then color = color + colors.orange end
- if ( second ) then color = color + colors.magenta end
- rs.setBundledOutput("top",color)
- os.sleep(10)
- end
Add Comment
Please, Sign In to add comment