Refactor item components to be stored as a map #62498
Merged
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.
Summary
Infrastructure "Refactor item components to be stored as a map"
Purpose of change
Assigning components to crafting results from a list is pretty sketchy, when it should get split up to multiple result items. I need it to be less sketchy for #60885.
Describe the solution
Turn components into a map and make a wrapper class around it for some easier handling. Then adjust all the code to work again. Also replace a hacky solution in the invlet test with a proper one.
This adds a fairly prevalent error message when components can't be evenly distributed to resulting items when crafting a recipe. I do believe that needs to be fixed one way or another, but if it's too much of an annoyance, the messages can be removed and some automated way to identify such problematic recipes can be devised.
Describe alternatives you've considered
Go even further with the refactor, but this wasn't planned for the charge removal project so I don't want to spend more time on it than necessary.
Testing
Not much yet. Game loads old saves, can disassemble old items, can craft new items, tests pass locally.
Also indirectly tested with #60885 and #63704.
Additional context