Skip to content
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

Do not count magazine as pocket in the pickup inventory #73107

Conversation

osuphobia
Copy link
Contributor

Summary

Bugfixes "Only count CONTAINER type pockets in the pickup inventory"

Purpose of change

MAGAZINE/MAGAZINE_WELL type pockets don't really serve as pockets the way CONTAINER type pockets do, you can't pick up and hold things with them directly, so don't count them in the pickup inventory.
Close #72807

Describe the solution

When try to pick up frozen_liquid and ammunition_type items, MAGAZINE/MAGAZINE_WELL type pockets that use these items as ammo will no longer be considered. If you don't have any capable CONTAINER type pocket, failure message is returned.

Describe alternatives you've considered

Not to do this.

Testing

Be nude.
Spawn bows, guns, mags, misc repairkit, etc, unload them. Try to pick up ammo while wielding one of them, only to see Does not fit in any pocket!.
Spawn a water cannon, unload it and pour water on the ground, freeze the water and crush it. Try to pick up ice shard while wielding the water cannon, only to see Does not have any pocket for frozen liquids!.
Behavior before is shown in #72807.

Additional context

1234
5678
147
258

@github-actions github-actions bot added Info / User Interface Game - player communication, menus, etc. Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Items: Containers Things that hold other things <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions labels Apr 18, 2024
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Apr 18, 2024
@osuphobia
Copy link
Contributor Author

osuphobia commented Apr 19, 2024

The test case item_cannot_contain_contents_it_already_has failed.

Checked the code and found out that it's not likely to be my fault.

It's checking whether the test_backpack can contain water_item or not, but the test_backpack is not watertight.

So backpack_loc->can_contain( water_item ).success() should always be false, and !backpack_loc->can_contain( water_item, false, false, true, false, bottle_loc ).success() should always be true. There is no chance CHECK( backpack_loc->can_contain( water_item ).success() ) would pass.

Then why was this test case got passed before? I do modified can_contain, but it should not affect this test.

can_contain is not checking whether it's watertight or not, the fact is I missed one parameter.

@osuphobia
Copy link
Contributor Author

Well, I was wrong, I did mess it up.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Apr 20, 2024
@osuphobia osuphobia marked this pull request as ready for review April 20, 2024 04:37
@Maleclypse Maleclypse merged commit 3ceec3d into CleverRaven:master Apr 21, 2024
39 checks passed
@osuphobia osuphobia deleted the Do-not-count-magazine-as-pocket-in-the-pickup-inventory branch April 22, 2024 04:16
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) [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Info / User Interface Game - player communication, menus, etc. Items: Containers Things that hold other things json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should not consider MAGAZINE/MAGAZINE_WELL as pocket in the pickup inventory
2 participants