Display name of loaded ammo instead of ammo type #51439
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
Interface "Display name of loaded ammo instead of ammo type"
Purpose of change
Magazines and guns loaded with different ammo variants are indistinguishable from each other in the inventory screen. The suffix displayed after the gun/magazine name shows the amount of ammo loaded but instead of ammo name it shows ammo type. This PR changes the suffix to show actual ammo loaded when there is ammo.
Describe the solution
Change
item::display_name
. When there is ammo loaded, use the name of the ammo asammotext
. Otherwise compute it as before.Describe alternatives you've considered
Testing
Spawn a bunch off different weapons, magazines and ammo variants. Load magazines with different ammo variants.
Before:
![image](https://user-images.githubusercontent.com/8000047/132262227-bc361af1-b298-4318-b7fa-63cf5d6e05bf.png)
After:
![image](https://user-images.githubusercontent.com/8000047/132262235-ee4105a1-f22a-441f-9b2d-5b4ad113ceb4.png)
Additional context
The display of ammo type was introduced in #36474. The author did intend to show ammo loaded, but it didn't work, likely due to some problems with the ammo infrastructure, which seems to be working better now. Or maybe it did work at the time, but some later refactoring broke it?