Secondary machinegun fire with 2-3 bullets left might lose you 1-2 bullets
Summary
If you use the secondary machinegun fire when you only had 2-3 bullets loaded in your machine gun, and in your inventory, there are still some bullets remaining, you will instead fire a single shot and reload instantly. Your total ammo will go down by 60, although you didn't actually fire the last bullet(s). Therefore, you have lost 1-2 bullets without actually shooting them.
Xonotic version: xonotic@6e840f8f
Terminology
- “bullets in your machine gun” means the bullets that are actually loaded. These are the bullets you have to reload, and this is represented by the circle around your crosshair
- “bullets in your inventory” means the bullet ammo that is NOT loaded in your machine gun. It's shown in your ammo display (as number) at the bottom and you can pick this ammo up
How to reproduce
- Start an empty Deathmatch, default settings
- Pick up a machinegun
- (Yow should now have a fully loaded machinegun (=60 bullets) and 80 bullets in your inventory)
- Fire bullets with primary fire until only 2 bullets remain in your machinegun
- Use secondary fire
(hint: counting bullets is easier if you start counting down from 15. This is the case when the “ammo circle” shows exactly 1 quarter left)
Expected result
Anything sane, for instance:
- prevent secondary fire (because it requires 3 bullets), or
- you will fire two rapid shots (instead of three), then reload, or
- you will fire a single shot as if in primary fire and don't reload
Actual result
You will fire a single shot (as if in primary fire), the game forces you to reload. This does not make sense and is annoying because you should still have a single bullet left in your machinegun. Also, keep in mind that you have now fired 59 shots in total. However, after the reload, your ammo in your inventory is reduced by 60, so 20 bullets in your inventory remain. But 80-59=21, so the final bullet in your machinegun has disappeared!
Further findings
Do the first experiment again, but this time, make sure you have 0 bullets left in your inventory before shooting. Now Xonotic will prevent you from using secondary fire if you have 1-2 bullets left.
Do the first experiment again, but this time, fire until you have 3 bullets left, then use secondary fire. You will still only fire 1 shot and reload, so this time, you have lost 2 bullets!
Analysis
It seems like Xonotic only checks the ammo in your inventory instead the ammo that's actually loaded in your machinegun. So the fix seems to be that for the machinegun, the “ammo checking routine” must look at the ammo in your machinegun instead of the ammo in your inventory.