Nesting big bag tests and fixes for disapearing items #60151
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
Potential fix for a bunch of issues I can't find related to disappearing items when using holsters.
Describe the solution
Basically when you had restrictions and rules on a pocket the nesting rules got a lil' wild with where they would try to put stuff. So sometimes stuff would end up being too large of volume for where it could go. This would usually be caught by best pocket when actually doing the insert but you would already be mid trying to insert so sometimes the item would be irreparably deleted.
I've added to the recursive call the ability to check the parents remaining volume so that if a pocket that you think "can" contain an item isn't rigid it'll check if it'll become too big to fit.
Describe alternatives you've considered
Testing
Added a unit test for this behavior. The basic case is:
Add a small worn bag to the character, insert into it a larger bag, add some sort of whitelist on the worn small bag, try to pick up something that would fit in the big bag but not the small bag. Before it would say you could then throw errors, now it will properly say that you cant.
Additional context