Only display categories that have loaded entries
DaFuqs opened this issue ยท 5 comments
Is your feature request related to a problem? Please describe.
When all load conditions validate to false a category shows up, but is completely empty.
My mod uses a category where entries make extensive use of display conditions.
Namely the chapter is about mod integration where all mods are listed with their integration I built for them.
In cases where none of the mods are present it would be nice for the category to not show up at all, to not confuse the player with an empty category.
Describe the solution you'd like
Categories should only render when having entries.count() > 0
One temporary solution for you could be to use a condition on the category (e.g. an or condition with "mod loaded" for each of the mods).
We could add your suggestion as builtin functionality on the category, but I think a category condition is better.
That in turn means you could do a custom condition that checks for that or I can add it in modonomicon - you can also PR it if I am too slow.
Something like "categoryNotEmpty condition" and I think the condition context should allow to access the category
Absolutely. I will poke at it and see what sticks.
I will try entry_count
with NumberRange.IntRange as check (min-max). Makes it a bit more dynamic. No idea if that can be useful in such detail somewhere, but you never know.
Yeah I think that is fine - if we need something more advanced we can upgrade / add an additional one and run our own network encoding
IntRange
s can be serialized from json, but have no way to send them over the network. But a simple condition will do just fine, I am sure.
Implemented via #194