Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- remove duplicate serums
- local chest = peripheral.wrap("back")
- while true do
- local serumTable = {}
- for i=1, chest.getInventorySize() do
- local itemStack = chest.getStackInSlot(i)
- if itemStack then
- if serumTable[itemStack.name] ~= nil then -- there exists another serum of this type
- if itemStack.dmg < serumTable[itemStack.name] and chest.getStackInSlot(serumTable[itemStack.name]) then -- the one in the chest is higher quality
- if chest.getStackInSlot(serumTable[itemStack.name]).dmg == 16 then
- chest.pushItem("up", serumTable[itemStack.name], 1)
- end
- else
- if chest.getStackInSlot(i).dmg == 16 then
- chest.pushItem("up", i, 1)
- end
- end
- else -- serum hasn't been seen yet, so add to table
- serumTable[itemStack.name] = i
- end
- end
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment