CleverRaven / CleverRaven/Cataclysm-DDA
Firing mode toggle on firearms keeping them from stacking
- Dominant language
- C++
- Stars
- 13.1k
- Forks
- 4.6k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 200
Description
# Describe the bug
When you get a new firearm, a variable is not set until you toggle the firing mode on the firearm. This was revealed when I looked at my cleaned firearms with debug mode on.

Both of those rifles in the image above are clean, but the difference is that I changed the right rifle's firing mode, which made it so the right rifle wouldn't stack with the left rifle until I did the same to the left rifle.
item:: mode, default is semi-auto mode, which was what the left rifle was already set to when I picked it up to toggle it to auto fire, then back to semi-auto mode to get that variable to be set.
# Steps To Reproduce
Steps to reproduce the behavior:
1. Make a player with a few of the same gun with an auto and semi-auto firing mode.
2. Note that the guns stacks in your inventory. Wield one gun.
3. Change the firing mode on your wielded gun to auto and back, then unwield. Note that you now have two stacks of the same gun in your inventory.
# Expected behavior
They should stack.
Fix is probably to just make sure that all new guns have the variable, item:: mode, default set on them.
# Screenshots

The three rifles at the top haven't had their firing mode touched, and is cleaned. The bottom rifles are clean, but had their firing mode toggled to auto, then back to semi-auto.
# Versions and configuration
- OS: Window 10
- Game Version: O.D-11016-g91d7b51
- Graphics version: Tiles
- Mods loaded:"dda",
"no_npc_food",
"magiclysm",
"aftershock",
"crt_expansion",
"FIC_Weapons",
"growable-pots",
"ew_pack",
"makeshift",
"Medieval_Stuff",
"More_Survival_Tools",
"nw_pack",
"alt_map_key",
"Cata++",
"Mining_Mod",
"my_sweet_cataclysm",
"MMA",
"vamp_stuff",
"Arcana",
"vamp_stuff+arcana",
"more_locations",
"No_Rail_Stations",
"deoxymod",
"blazemod",
"Heavy miners",
"Tanks",
"necromancy",
"Arts' Guns",
"no_religious_Texts",
"novitamins",
"speedydex",
"secronom",
"stats_through_kills"
Contributor guide
Research direction
Reproduce the issue with multiple firearms that support semi-auto and auto modes, then trace how new guns initialize item::mode and how firearm stacks are compared. Done means newly acquired guns have the default semi-auto mode set and identical clean guns stack after toggling and unwielding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100