Fix invalidation of soft container nested in a holster #72417
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
None
Purpose of change
There is a bug:
When picking up items, players can't put them into a soft container nested in a holster. (Players are not likely to do this in vallina DDA, but it will happen when using ‘lifting field’ of MindOverMatter). In addition, when the soft container is placed in a holster, the available capacity of the player will also be underestimated.
This PR is to solve it.
Describe the solution
1.Ignore regidity of nested pocket if current pocket is a holster.
2.If a pocket is a holster with an item, use the volume of contents when it is full as the pocket capacity. For non-container or rigid container, it is the volume of itself. For soft container it will add all of the remaining volume of soft valid pocket.
Describe alternatives you've considered
A soft holster nested in another one is not considered, which will lead to higher capacity showed on the UI. To obtain accurate results, a recursive function may be required. Since in the actual game this is very rare, from a performance perspective, it seems not worth it to do so.
Even if you do want to try that, it won't lead to worse results. Instead, if the result is lower than the actual, it will prevent you from picking up items normally.
Testing
Tested in game.
Additional context
Codes of nested container are really complicated!!