-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CR] Fix nested pockets pickup #54941
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are quite some discrepancies between can_contain and best_pocket functionality. This commit looks to fix that and actually allow nested pockets to work properly as long as there is space. fixes CleverRaven#54725
mqrause
reviewed
Jan 31, 2022
There are quite some discrepancies between can_contain and best_pocket functionality. This commit looks to fix that and actually allow nested pockets to work properly as long as there is space. fixes CleverRaven#54725
…into nested_pockets
Apologies for the mess. Github does not agree with rebases on branches for existing PRs. Had to change the target branch from- and back to fix. |
mqrause
reviewed
Feb 4, 2022
You need to force push after rebasing. |
mqrause
reviewed
Feb 4, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
astyled
astyled PR, label is assigned by github actions
BasicBuildPassed
This PR builds correctly, label assigned by github actions
<Bugfix>
This is a fix for a bug (or closes open issue)
Items: Containers
Things that hold other things
json-styled
JSON lint passed, label assigned by github actions
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 "Nested pickups using (g) interface"
Purpose of change
Nested pickups were not working as intended.
Looking at couple of issues, there were instances where an item was flagged as 'valid' for picking up (using (g) menu), but was not actually picked up correctly because of a mismatch of intended functionality.
Found a couple of (slightly) related issues, among others: #54725 #53807
Describe the solution
This PR looks to streamline checks between
character::can_pickVolume
toitem::can_contain
, anditem::best_pocket
functionality, while also using recursion to allow deeply-nested pickups (i.e.socks -> tin -> pot -> bucket -> backpack
) if the volume allows for it.Describe alternatives you've considered
A smaller fix could be made just to
item::can_contain
to streamline intended functionality.Deeply nested pockets would not be possible, but items would also not be flagged as 'valid' pickup as they are now.
Testing
Thoroughly tested using different related issues as a base, namely using the attached save from #54725.
Using the save, one can play around with the different containers to see if nesting is actually working as intended.
Additional context
Trying to pickup too many items in one go is still possible, and fails silently (i.e. trying to pickup two stones, but one fails because inventory is full after picking up the first). This should still be fixed, but I thought it'd be out of scope for this 'fix'.
Removed (slightly related) code duplication between
character::can_pickVolume
andcharacter::canPickVolume_partial
.Replaced contain_code for
item_pocket::can_contain
anditem_pocket::is_compatible
.A followup issue would be solving multi-pickup cancellation due to full inventory (either prevent it, or give the player a headsup).