Clay Pipe with Filter
tokoku-11 opened this issue ยท 13 comments
...oh. This is a very tough bug to solve, as it essentially requires the rewrite of the entire lens/filter system. For this, you might find it is better to use regular pipes with filters on them and not clay pipes.
@Kubuxu - regular stone pipes will work in the same way with filters.
Will they prioritize inventories?
And will they prioritize inventories if there are two filters of same color but one toward inventory.
@Kubuxu - No, I'm afraid, but those are much rarer usecases. If you look into the source code, you will see why it is so hard to do with the current system.
Wouldn't it work if the pipes' event handlers were a lower priority than the pluggables'?
That way the clay pipe won't try to push the wrongly colored items through the filter.
@viliml - that causes other pipes to break. I think a priority system would help?
Well, either a priority system, or "pre" and "post" sub-events for FindDest.
Are you sure making pluggables process before pipes would cause some of them to break? The only handlers using that event besides Filters are Clay, Diamond and Diazuli pipes, so the only change would be ensuring the filter is run first.
- In the case of the Clay pipe, it would remove ones that didn't match the color, and specifically fix this problem
- In the case of the Diamond and Diazuli pipes, they would only be able to choose between routing into one of the sides the filter allowed, blocking the others, just as before.
Oh, right, I see what you meant. There are other events and some of them would break if pluggables were ran first? But even then, the behavior right now is random, so adding any kind of order shouldn't break it...
Either way, The PipeEventItem.FindDest event could be split into PlugDest(pluggables would remove certain sides from the list of possible destination) and ChooseRoute(the pipe would choose which of the remaining possible destinations to send the item). Both names subject to change.
Ah, I see! A diazuli(actually called daizuli? whatever) pipe with a filter of the same color on the side where correctly colored items should NOT go, ends up sending them right there. In this case the filter needs to go last.
So your priority system is indeed the only real way to solve this:
Diazuli(and diamond) pipes actively send pipes in a certain direction
Filters stop wrongly-colored items from going a certain way.
Clay pipes passively choose one of the remaining possible directions, preferably an inventory.
There's no other solution but 3 priority levels.