The Junk Food Zone: Full Metal Soda

Can a zone sort out junk food in containers?

A custom zone with “m: junk food” as its filter doesn’t match “aluminum can of cream soda”. The item falls through to be sorted by a later non-custom “drink” filter. Presumably, the item’s material is aluminum, which is not bad for you like junk food is.

As a fall-back, I have tried custom zone with a comma-delimited filter, intending to list each junk food individually, by name. This has not worked. Starting with no commas, a custom zone with only “cream soda” as its filter doesn’t match “aluminum can of cream soda” - the item also falls through to the “drink” zone.

In my experience, soda never was categorized as junk food and was always categorized as ‘drink’, even before the containers overhaul. Can’t speak to why the custom filter gave up on it though, never tried those.

I can verify at least for build #10950 that cream soda is “made” from the “material” Junk Food and the category is Food.
Weirdly enough, in my test it also did not sort it into the drink zone, although I’m not running the newest experimental, so it might is fixed there… the only zone it would go to was food.

That’s really weird… Again, maybe a newer (or older) experimental version is different than what I’m running, but in my test it worked with “cream” and “cream soda”.
Is it possible that the zone was too far, deactivated or overlapping with an other zone (overlapping zones do have some quriks and will not move items there if there are already items from an other defined zone)?

Edit:
Testing this with the stable and the newest experimental shows that the cans do go into the “drinks” zone in stable, but not so in the newest experimental, so I guess something broke (probably because of the containers update). This means that you are in the stable…
This does however not change much… While they are indeed made from the material Junk Food there too, only the material of their “container” - aluminium can or plastic bottle - counts.
But even there the can did move to the custom spot I’ve set up with “cream” as a filter, so I guess you indeed have overlapping zones.

For the original post, I was running 0.E-2. There, it does go to a Drink zone, when a Food zone exists.

For a test today, I pulled from github; built with defaults; executed; found an aluminum can of orange soda; made some single-tile non-overlapping zones for Unsorted, Drink, and Food; dropped the soda item in Unsorted; and finally sorted with O o. The item went to the Food zone, as when you tried it.

Yep! Accurately deduced. Back in the 0.E-2, I did have an unrelated Custom zone (for some items renamed with markers) that overlapped the prospective Junk Food Zone, and one item in that tile from that zone. Resolving that overlap, a Custom zone with “cream” or “cream soda” now works as intended. So that workaround … works … around. Sweet, thanks.

This hacky script builds Custom zone filters for all junk food. Since each filter is limited to 256 characters, several non-overlapping zones are needed. I tested it on 0.E-2 and current from github. Something tells me I shoulda spent this time toward a fix rather than a workaround. Hoarding mindset. I am a zombie.

awk 'BEGIN {n="";m=""} /^[ \t]*{[ \t]*$/ {n="";m=""} /^[ \t]*["]name["]:[ \t]* ["]/ {match($0,"^[ \t]*\"name\":[ \t]*\"([^\"]*)\"",out);n=out[1]} /^[ \t]*["]name["]:[ \t]* {/ {match($0,"^[ \t]*\"name\":[ \t]*{[ \t]*\"str[^\"]*\":[ \t]*\"([^\"]*)\"",out);n=out[1]} /^[ \t]*["]material["]:.*["]junk["]/ {m="junk"} /^[ \t]*}/ {if (m=="junk") print n}' data/json/items/comestibles/*.json|tr ' ' '@'|tr '\n' ' '|fold -sw256|tr ' ' ','|tr '@' ' '|sed 's/,$//';echo

Anyway… With the overlap resolved in 0.E-2, a Custom zone with “m: junk food” still doesn’t catch aluminum can of cream soda. Even in the current build from github and a similar setup, the “m: junk food” filter misses aluminum can of orange soda. It seems that “m: junk food” doesn’t work on contained food.

Is there a better way to filter out junk food?

At the moment - be it 0.E stable or the newest experimental - no. At least I don’t know of any…