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

Don't add magazines to all guns, don't show "(empty)" on unreloadable guns. #48864

Merged
merged 5 commits into from Jul 6, 2021

Conversation

Hirmuolio
Copy link
Contributor

@Hirmuolio Hirmuolio commented May 13, 2021

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.

@Maleclypse Maleclypse added <Bugfix> This is a fix for a bug (or closes open issue) Items: Magazines Ammo holding items and objects. [C++] Changes (can be) made in C++. Previously named `Code` labels May 15, 2021
@actual-nh actual-nh added Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves Items: Battery / UPS Electric power management labels Jul 2, 2021
@ZhilkinSerg ZhilkinSerg merged commit 5ed1b9b into CleverRaven:master Jul 6, 2021
@Hirmuolio Hirmuolio deleted the empty branch July 31, 2021 22:06
ZhilkinSerg added a commit to ZhilkinSerg/Cataclysm-DDA that referenced this pull request Aug 12, 2021
ZhilkinSerg added a commit that referenced this pull request Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves Items: Battery / UPS Electric power management Items: Magazines Ammo holding items and objects.
Projects
None yet
4 participants