fix unloading containers which also have other types of pockets #58315
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
Bugfixes "fix unloading containers which also have other types of pockets"
Purpose of change
fix #55481, fix #54330
Describe the solution
If an item has a CONTAINER pocket it is treated as container by character::unload and nothing else.
Before, containers with additional multiple pocket types, for example rc_car or multi_cooker, still had all their standard pockets unloaded as a side-effect. This included unloading batteries.
Then pr #53250 changed this to only unloading CONTAINER pockets (which makes sense):
However, batteries are now no longer unloaded, causing #55481 and #54330.
The fix in this pr restores the old behaviour by explicitly unloading all standard pocket types of a container using the function introduced in pr #53250, maintaining the functionality of the pr.
Describe alternatives you've considered
There could probably be some better refactoring of character::unload, but I feel this changes the code as little as possible avoiding regressions.
There could be unintended side-effects with the originial behaviour, for example if a new gun is added which has a snack compartment. This gun would be treated as container and mods with magazines could no longer be unloaded. But until then this should be fine 馃槂
Testing