feat: port nested categories #6930
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose of change (The Why)
Player QOL. The crafting menu can be annoying to navigate and find recipes quickly. This helps to group them more finely than just armor/foods/etc.
Describe the solution (The How)
ports change CleverRaven/Cataclysm-DDA#59924 to begin allowing nested crafting categories.
This means we can now define a nested_category, which will display in the recipe selection screen, and once selected will transfer you to the
NESTEDtab with a selection of everything from that nested category.Describe alternatives you've considered
porting DDA change CleverRaven/Cataclysm-DDA#60761. This seems to be out of my skill level, as it has a bunch of prerequisite PR's that I don't know how to properly sift through and apply. (I have attempted though, to no success)
Additionally, to improve the quality of life, we could port CleverRaven/Cataclysm-DDA#60378, CleverRaven/Cataclysm-DDA#60683. Note that a large portion of the code changes made in these PRs are ripped out for 60701, so if we could just jump ahead and implement that, it would save a lot of time & effort.
Testing
Created a nested_category "sandwiches" and moved the sandwich recipes under this new category. Loaded in and attempted to craft a recipe from the nested sandwiches category successfully.
Additional context
Before merging, we need to fix the issue that nested categories display a lot of useless, irrelevant information about the item that was previously displayed. I think this may have been tackled in the original PR, and I just don't have it implemented properly?
It does seem weird to have to move these recipes out of the main list, but I think will make more sense once we get a majority of relevant items converted into nested categories.
Example nested category: (intended to be put into a new file, nested.json or a similar name for organization)
[ { "id": "nested_example", "//": "this is an example of how a nested category should be defined", "type": "nested_category", "category": "CC_FOOD", "subcategory": "CSC_FOOD_OTHER", "nested_name": "example sandwiches", "description": "Recipes related to constructing example sandwiches.", "skill_used": "fabrication", "nested_category_data": [ "sandwich_t", "sandwich_pb", "sandwich_pbj", "sandwich_pbh", "sandwich_pbm", "sandwich_deluxe", "sandwich_deluxe_nocheese", "fish_sandwich", "sandwich_veggy" ], "difficulty": 0, "autolearn": true } ]Additionally, each of these items needs to be moved from subcategory CSC_FOOD_VEGGI to CSC_*_NESTED.
{ "type": "recipe", "result": "sandwich_pb", - "category": "CC_FOOD", - "subcategory": "CSC_FOOD_VEGGI", + "category": "CC_*", + "subcategory": "CSC_*_NESTED", "skill_used": "cooking", "time": "1 m", "autolearn": true, "components": [ [ [ "bread_sandwich", 2, "LIST" ] ], [ [ "peanutbutter", 1 ], [ "peanutbutter_imitation", 1 ] ] ] },📸 Screenshots
Checklist
Mandatory
closes #1234in Summary of the PR so it can be closed automatically.mainso it won't cause conflict when updatingmainbranch later.Optional
Co-Authored-Byin the commit message.doc/folder.lang/bn_extract_json_strings.shscript if it does not support them yet.