Skip to content

[Bug]: Underbarrels don't fully respect ammoConsumedPerShotCount #3994

@Arcalane

Description

@Arcalane

Specifications
Rimworld version: 1.5
Combat Extended version: 1.5.6.3.1
Combat Extended source (Steam, GitHub, etc.): Github
Your operating system: Win11
Your mod list: CE, Outer Rim Core

Description
An underbarrel configured to use ammoConsumedPerShotCount will consume the specified amount of ammo with each shot, but will also be able to fire even if the magazine content is insufficient. This is easily triggered by using it to represent a 'charged shot' mode, where the standard mode consumes a single unit from the magazine whilst the 'charged' mode consumes 2 or more. Deplete the magazine to the point where it is less than the quantity required for the 'charged' mode to fire, and it will still be able to fire a shot normally.

Expected behavior
For the charged mode to fail to fire when the magazine count is insufficient, and instead force/require a reload.

To reproduce
The easiest way to reproduce this is to make a weapon that has an underbarrel mode with oneAmmoHolder and ammoConsumedPerShotCount greater than 1.

For a very simple replication, use the patch data in #3909 - load Outer Rim Core and spawn a Bryar Blaster Pistol (OuterRim_K16BryarBlaster). In standard mode it consumes 1 shot from the 24-shot cell, whereas in charge mode it consumes 6. Fire at a valid target until the magazine content is not evenly divisible by 6 (so, 1 shot from full load) and then swap to overcharge mode. If you only fired 1 standard shot, it should still be able to fire 4 charged shots; the cell will correctly deplete by 6 each time, but the final shot should still fire despite there being only 5 shots left in the cell.

Complete the following checklist
I hereby verify that I have done the following:

  • Confirmed that my game version and load order are correct.
  • Confirmed that I am running the appropriate and most updated version of Combat Extended and required compatibility patches.
  • Confirmed I am not running any mods with known incompatibilities with Combat Extended.
  • Disabled Combat Extended and attempted to reproduce the behavior without success.

Metadata

Metadata

Labels

BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions