- W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, burst_ammo), weaponentity);
+ float ammo_available;
+ if (WEP_CVAR(machinegun, reload_ammo) > 0)
+ {
+ ammo_available = actor.(weaponentity).clip_load;
+ }
+ else
+ {
+ ammo_available = GetResource(actor, thiswep.ammo_type);
+ }
+
+ // We don't want to shoot 3 rounds if there's 2 left in the mag, so we'll use a fraction.
+ // Also keep the fraction <= 1 otherwise we'd mag dump in one burst.
+ float burst_fraction = min(1, ammo_available / WEP_CVAR(machinegun, burst_ammo));
+ int to_shoot = floor(WEP_CVAR(machinegun, burst) * burst_fraction);