Don't add magazines to all guns, don't show "(empty)" on unreloadable guns. #48864
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
Infrastructure "Don't add magazines to all guns, don't show "(empty)" on unreloadable guns."
Purpose of change
Fixes: #48860
Fixes: #48851
Unreloadable guns would show "(empty)" on their names when wielded making it seem like they need reloading.
Unreloadable guns would show the option to reload them.
Describe the solution
Check
item::is_reloadable()
before showing "(empty)" on guns.item::is_reloadable()
though that unreloadable guns were reloadable.This was because all guns that didn't already have an magazine data would get one anyways.
Now that magazine addition is no more.
Feral human rock throw had no magazine. Now it has magazine defined in json.
Describe alternatives you've considered
Testing
Feral humans still throw rocks.
Gun with no ammo/magazine (A7 laser rifle) doesn't show "(empty)".
Gun with magazine (AR-15) shows its ammo and empty properly.
Gun with integrated magazine (1887 Bootleg Shotgun) shows it ammo and empty properly.
Tests pass.
Additional context
The same place also adds magazine pockets to magazines that do not have them. I am not sure what is the purpose of that.
The same place also adds magazines to tools that do not have them. AFAIK that will do things for tools that have batteries without batteries. Probably also applies to things that have odd charges such as grenades.