So I was trying to find a way to list every item in category ‘other’ and getting confused.
Maybe I have some misconceptions which can be cleared up, but is ‘category’ not a mandatory field for items? Like pipe_cleaner doesn’t have a category specified where it is defined in generic.json (though it is specified as
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_TOOLS",
in the recipe in recipe_other.json. So maybe that counts. Or maybe any item that doesn’t have a category defined is set to “other” by default.
I’m using AstroGREP now so it’s really easy to find every item with “category”: “other” but finding items that don’t have a category listed isn’t so straight forwards.
Item and recipe categories are not related. Item category is not mandatory and if it is not set in json - it is calculated (see calc_category
function in item_factory.cpp
).
Should Item category be mandatory? Or give a ‘warning’ in a debug log or something if not present?
calc_category doesn’t help me much in itself because I’d need to backtrack through the code to see where and how the .tool .gun etc. values are determined. I had a look, but it’s a bit much for me.
If I was going to guess, I’d guess that pipe cleaners aren’t recognized as being tools because you can’t (a)pply or (a)ctivate them.
The whole thing about calculated categories, though, means that I can’t just rely on searching the json to generate lists. It makes it more handy for the debug spawn filter to have a category filter.
The thing is categories are not mandatory for item definition, some item definitions in json lacks category data and category is calculated automatically instead. Thus if you want to compile a list of all items with their categories you need to use that category autocalc code.