-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Show ammo_restriction info for non-MAGAZINE items #41532
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
4812c7b
to
2a06edb
Compare
I ran |
CI failures appear to be caused by known problems in the comestible test (recipe kcals), not related to my changes. |
Non-magazine items with non-magazine pockets (including quivers), yet having an ammo_restriction defined, were not indicating their capacity in the item info panel. This commit allows non-MAGAZINE item contents/pockets to indicate their ammo_restriction-based capacity in the pocket section, labeled "Holds:" Existing MAGAZINE-type containers (as well as GUN and TOOL items with MAGAZINE pockets) continue to indicat their magazine capacity info in the magazine section of the item info. Add a test case covering this behavior using existing test items.
CI failure appears unrelated, and one I have seen pop up before:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Info / User Interface
Game - player communication, menus, etc.
Items: Ammo / Guns
Ammunition for all kinds of weapons and these weapons themselves
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
SUMMARY: Bugfixes "Show ammo_restriction info for non-MAGAZINE items"
Purpose of change
Non-magazine items with non-magazine pockets (including quivers and ammo pouches), yet having an ammo_restriction defined, were not indicating their capacity in the item info panel.
Fixes #40521
Describe the solution
Allows non-MAGAZINE item contents/pockets to indicate their ammo_restriction-based capacity in the pocket section, labeled "Holds:"
Existing MAGAZINE-type containers (as well as GUN and TOOL items with MAGAZINE pockets) continue to indicate their magazine capacity info in the magazine section of the item info.
Change the quiver and ammo pouch item descriptions to say "Use insert to store" rather than "Activate to store".
In the inventory screen, show the quantity of arrows/bolts in a quiver.
Add a test case covering related item ammo_restriction info display, both for the main item info / description panel, and for the display_name of the quiver with arrows loaded in it.
Describe alternatives you've considered
Previous attempt #41122 changed quivers to be MAGAZINES; this attempt aims to make ammo_restriction work for non-MAGAZINES as well.
Testing
Ran new unit tests with
tests/cata_test [ammo_restriction]
In-game, spawned a quiver and added some wooden bolts. Quiver ammo_restriction is indicated in the pocket section under "Total capacity:"
Ammo pouch now indicates its many ammo types:
In the inventory, quivers and ammo pouches will now indicate the total number of ammo items they contain. Prior to my changes, these did not show the
(nn)
counts. For example a large quiver with 51 of the same kind of arrow:Large quiver with 57 of different kinds of arrow/bolt:
Ammo pouch with pebbles:
When the quiver has some arrows or bolts loaded into it, the total volume/weight of those items is displayed in the pocket section, but the total capacity (which is zero for ammo_restriction pockets) is not displayed. Thus, as a normal (non-ammo) container pockets, it would be formatted like this:
But since the zeros are misleading, they are now hidden for ammo_restriction pockets:
Quivers may contain multiple bolts and arrows, although there are some quirks with how the
i
nsert menu works - it may disallow explicitly loading multiple kinds into the quiver, though if you pick the arrows or bolts off the ground (or spawn them from the debug menu), they may go directly into a quiver that already contains other bolts or arrows:Additional context
There are some inconsistencies and messaging problems with the
i
nsert menu, as noted above (and as described in the comments on #41122) but those are probably best addressed in a separate PR.