CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
9.98k stars 4.09k forks source link

Firing mode toggle on firearms keeping them from stacking #36716

Open DillonSimeone opened 4 years ago

DillonSimeone commented 4 years ago

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.

image

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

image

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

DillonSimeone commented 4 years ago

I just noticed that this also affects even firearms with only one firing mode!

image

image

Time to riot! I attempted to add the default mode flag to the left firearm by loading it with a mag and ammos then firing it a few times. Nothing changed aside from it getting a tiny bit fouled!

DillonSimeone commented 4 years ago

Aha! Added and removed a gunmod from the left cwd-63 in my previous comment. This got the default mode flag to show up on that rifle, so both now stacks.

image

DillonSimeone commented 4 years ago

Another one! The difference this time? One have been cleaned, and the other haven't been fired before.

image

image

DillonSimeone commented 4 years ago

Another one! Differences in age can make it impossible for guns to stack.

image

image

TechyBen commented 4 years ago

Wouldn't be too much of a problem if it was clear from the list which ones were cleaned etc. But stacking, then picking the first out based on quality etc would be a nice QOL change.