Cataclysm-dda: Glock 22 Mag Bug

Created on 21 Jul 2020  路  16Comments  路  Source: CleverRaven/Cataclysm-DDA

Glock 22 says it takes Sig 357 despite being chambered .40 S&W the mag states to only take 357

Steps To Reproduce

try and fire a glock 22 as described by the game with a loaded glock 22 mag loaded with 357 any ammo (it only takes 357 despite the glock 22 being chambered in .40)

Expected behavior

that the glock 22 should take a .40 S&W mag

Screenshots

-

Versions and configuration

Newest Experimental version, other users reported the same issue on other platforms

Additional context

-

<Bug> Good First Issue [JSON]

All 16 comments

Wait, you CAN'T use .40 ammo with the Glock 22..?

That's the only type of ammo my Glock will fire. I have a pile of 357 ammo in my base that the thing absolutely refuses to use...

Related https://github.com/CleverRaven/Cataclysm-DDA/issues/42254

I tested a bit, magazine for glock 22 can accept either sig .357 and .40 s&w ammo, and glock 22 accepts magazine for glock 22, if magazine loaded with .40 it shoot just fine, in case of loaded .357 it refuse to shoot. Need to fix glock 22 magazine i guess.
Probably there must be version of glock 22 which can use sig .357 ammo.

tested with 0.E-4254-gfea0266

Glock 22 takes .40 S&W and Glock 31 takes .357 SIG. Both use the same magazine. The magazine should be renamed to something like "Glock 22/31 magazine" for clarity purposes.

Glock 22 takes .40 S&W and Glock 31 takes .357 SIG. Both use the same magazine. The magazine should be renamed to something like "Glock 22/31 magazine" for clarity purposes.

Or, the description of the Glock 22 gun (at least the .40 S&W) shouldn't imply it can take both types of ammo..?
It currently states that the "default ammo" is .357 SIG JHP.
If you unload a Glock 22, the ammo type displayed next to the name of the gun isn't .40 S&W, but .357 SIG.

Maybe the Glock 22 item was originally .357 SIG only, and when a .40 S&W variant was added, some residual code wasn't replaced/removed properly..?

There doesn't seem to be any sort of "default_ammo" parameter for guns like there is for magazines. Default ammo is probably determined by some arcane magic like the lexical order of compatible ammo types.

Here https://github.com/CleverRaven/Cataclysm-DDA/blob/ab7a370c5055857c7c817a6815cf2e5086b6dfa9/src/item.cpp#L2077 it takes default ammo from magazine as default ammo for gun.
Here https://github.com/CleverRaven/Cataclysm-DDA/blob/ab7a370c5055857c7c817a6815cf2e5086b6dfa9/src/item.cpp#L7493 it do some magic to extract default ammo from magazine ammo_types, not sure what that line doing.
Code too complex for me.

Had the same issue with a Beretta I got off a zombie. Chambered for .40SW but the magazine was loaded with .357 and the gun wouldn't fire.

Can defiantly confirm this little gem. but the problem with trying to fix it, given realism.. the magazines are actually interchangeable because SIG .357 was based off the .40 casing. People have accidentally loaded the wrong ammo into the gun and couldn't properly chamber it or severely damaged the gun upon firing.

Edit: This is relating to the Glock, I have no personal experience with the Beretta, which is a shame. Love the gun but never actually held one.

Can defiantly confirm this little gem. but the problem with trying to fix it, given realism.. the magazines are actually interchangeable because SIG .357 was based off the .40 casing. People have accidentally loaded the wrong ammo into the gun and couldn't properly chamber it or severely damaged the gun upon firing.

Edit: This is relating to the Glock, I have no personal experience with the Beretta, which is a shame. Love the gun but never actually held one.

So... Technically this "bug" is sort-of-realistic behaviour?

Maybe this should be expanded upon, not removed entirely. Although, any NPC or pre-cataclysm character who loaded a gun with the wrong ammo shouldn't have lived very long due to the issues you brought up. Maybe if the default ammo was somehow changed, the rest could be tolerated? Preferrably the standard ammo used in damage calculations should be accurate, but not all player characters are firearms experts, so that could probably be tolerated if not easily fixed.

Wouldn't be the first time in gaming history an unintentional bug was realistic. Plus I also agree with potentially expanding upon this as expanding on it instead of just up and removing it would add much more realism to the game, I also noticed the gun only has Glock 22 magazines compatible when you can realistically put a Glock 31 magazine in it and vice versa, something to be worked on as well for expanding it. There is even conversion out there to allow the G22 to be a G31 but that would be good for later weapon modifications, and an entirely different suggestion.

May be a bit difficult to keep around while also fixing the other problems with npcs, but finding a zombie like I did earlier with the wrong ammo, would explain why he ended up that way.

There is no Glock 31 magazine as both guns use the same magazine that for some reason is named "Glock 22 magazine". For reasons unknown to me CDDA has decided that the default ammo for Glock 22 (plus few other guns) is .357 SIG even if the json file says that the only compatible ammo type is .40. It is possible that the game uses the available ammo types from the magazine json for deciding the default ammo for guns but adding "default_ammo": "40sw", to the magazine doesn't do anything (even if it did then we would have the same problem with Glock 31 because of the shared magazines).

I never found a G31 so I didn't know a magazine didn't exist, fix for that would be to make one for that gun exist, have its default ammo be 357 sig.

Semi related, the glock 22 currently comes loaded with ammo that it can't fire on 0.E-4395-g83ce24e

Semi related, the glock 22 currently comes loaded with ammo that it can't fire on 0.E-4395-g83ce24e

.357 SIG, right?

Semi related, the glock 22 currently comes loaded with ammo that it can't fire on 0.E-4395-g83ce24e

.357 SIG, right?

Yep,

image
image

Semi related, the glock 22 currently comes loaded with ammo that it can't fire on 0.E-4395-g83ce24e

.357 SIG, right?

Yep,

image
image

Then it's very much related.

Was this page helpful?
0 / 5 - 0 ratings