Ralfinator wrote:Another reason I'd like filters for storage chest is to bring some more order into the storage: ...
storage chests currently seem to at least
try to stay sorted by first selecting a storage chest that already has that item type in it, and if none exists, use a random empty storage chest, and if that doesn't exist either, use a partially used storage chest. this system currently fails pretty badly when a designated storage chest becomes empty, a newly arriving items gets put into a random chest (at the other side of the base) and all future arriving items of that type will travel across the whole map to that new random chest.
in my factory, I want to have lots of item types available for requesting them with requester chests or the player himself, and i use lots of buffer chests between assemblers. since it doesn't make sense to put the same item types into different storage chests when they are trashed by the character or get into the network by any other means (and then can't be used by the next assembler that wants to pull from the buffer chest), they can't be passive provider chests, but have to be storage chests. but this method only works as long as the buffer chest still has an item in it. it fails as soon as the chest gets empty, causing the next item to go to a random storage chest, eventually filling that other chest while the next assembler behind the buffer is almost starved.
to make this work, i use one conditional inserter between assembler and buffer chest to fill the buffer when it has too few items in it, and a second conditional inserter behind the storage chest that fills the following assembler only if there are "enough" items in the buffer chest. "enough" means that there are at least a few more items in the buffer chest than an inserter can move to the next assembler including the inserter bonuses. in general and as a buffer, this works fine, but it still fails quickly when too many items are requested from that buffer. thus the condition's limit might need to be higher, eg one stack, plus what the character requests, plus any inserter bonuses. for simple buffer chests, this is too much unused stuff, and it still fails when not enough new items are produced to quickly fill up the chest again.
the only real and safe solution to this problem would be to have filters on storage chests, and that the network has a well known defined order of preferences which chests to use first for newly arriving items (eg from active provider chests), and another order which chests to be used first to get items from them. such filtered storage chests would eliminate the need to fill buffers too much in advance "just in case" that someone requests items from it, and might solve quite a few other problems too.
a (partial?) sorted list of chests for storing newly arriving items
(just made up, maybe need to think about it a few times more):
- requester chests - with unsatisfied demands
- filtered storage chests - with such items already in them
- filtered storage chests - empty
- non-filtered storage chests - with such items already in them
- non-filtered storage chests - empty
- non-filtered storage chests - with other items in them
a (partial?) sorted list of chests for getting items from them on requests
(just made up, maybe need to think about it a few times more):
- active provider chests (since they need to be emptied anyway)
- any non-filtered storage chests (maybe first the one with the least items of that type, to empy storage chests fast)
- any filtered storage chests (maybe first the one with the most items of that type, to keep buffer chests balanced)
- passive provider chests (since they are only refilled by crafting and not newly arriving items)
here, "filtered storage chest" means a chest with filters and some of them set, "non-filtered storage chest" means a chest with filters and all of them undefined, and in case that there are still "normal" storage chests besides these new chests last priority to those oldstyle storage chests (with such items, empty, with other items)
someone made a similar suggestion and added some rules to always balance all storage chests that have the same items in them. I don't like that idea since it would require a lot of work (for the CPU as well as for the robots), and would cause many new problems, eg when you want to merge some chests and robots keep splitting the contents equally, thus undoing the merging while it takes still place.
It still might be useful to do some balancing (eg to have buffer chests filled equally), but only by selecting the chests in the above list of priorities while new items get into the network and not doing it afterwards and all the time.
another solution might be to introduce a flag (either in general options, or for each single chest) to never automatically completely get rid of all items and always keep at least one item of each type per chest, or one item of each type per stack. those "last items" would serve the same purpose as the filters, similar to ctrl-clicking to reserve slots in the hotbar: insert one specific item manually to reserve the chest for that type, or randomly get such "first items" inserted into empty chests thus reserving them automatically, and only remove that last item manually to stop the chest getting all future items of that type. (idea from logistic pipes in minecraft :-)
does anybody know of a mod that does something similar ?
the cyberchest mod has an option to keep the last item when crafting from that chest, but that chest is meant for something completely different than storage (something like a mixture of requester and crafter chest) and items can still be removed from it by inserters
ps: in factorio 0.13.4, watch out for such buffer chests: when a buffer with the abovementioned two inserters is "fast replaced" by another chest (eg steel chest by storage chest when they become available), only one red/green wire connection is kept and the second (and third and fourth) connection gets lost. and the remaining connection also doesn't work any longer and requires the inserter to be deleted and rebuilt.