From 11fb416403753ef4e51502de84fe0e27297c46d2 Mon Sep 17 00:00:00 2001 From: drjaska Date: Thu, 5 Sep 2024 20:15:25 +0300 Subject: [PATCH] Fix forced reloading with weird ammo configs --- qcsrc/common/weapons/weapon/machinegun.qc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index db979d61a..2178a5198 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -173,7 +173,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen { // forced reload - wait until the bulletcounter is 0 so a burst loop can finish if (WEP_CVAR(WEP_MACHINEGUN, reload_ammo) - && actor.(weaponentity).clip_load < min(max(WEP_CVAR(WEP_MACHINEGUN, sustained_ammo), WEP_CVAR(WEP_MACHINEGUN, first_ammo)), WEP_CVAR(WEP_MACHINEGUN, burst_ammo)) + && actor.(weaponentity).clip_load < min(min(WEP_CVAR(WEP_MACHINEGUN, sustained_ammo), WEP_CVAR(WEP_MACHINEGUN, first_ammo)), WEP_CVAR(WEP_MACHINEGUN, burst_ammo)) && actor.(weaponentity).misc_bulletcounter >= 0) { thiswep.wr_reload(thiswep, actor, weaponentity); @@ -247,7 +247,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen METHOD(MachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { float ammo_amount; - if(WEP_CVAR(WEP_MACHINEGUN, mode) == 1) + if(WEP_CVAR(WEP_MACHINEGUN, mode) == 1 || actor.(weaponentity).misc_bulletcounter != 1) ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_MACHINEGUN, sustained_ammo); else ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(WEP_MACHINEGUN, first_ammo); @@ -288,7 +288,7 @@ METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weapone { if(actor.(weaponentity).misc_bulletcounter < 0) return; - W_Reload(actor, weaponentity, min(max(WEP_CVAR(WEP_MACHINEGUN, sustained_ammo), WEP_CVAR(WEP_MACHINEGUN, first_ammo)), WEP_CVAR(WEP_MACHINEGUN, burst_ammo)), SND_RELOAD); + W_Reload(actor, weaponentity, min(min(WEP_CVAR(WEP_MACHINEGUN, sustained_ammo), WEP_CVAR(WEP_MACHINEGUN, first_ammo)), WEP_CVAR(WEP_MACHINEGUN, burst_ammo)), SND_RELOAD); } METHOD(MachineGun, wr_suicidemessage, Notification(entity thiswep)) -- 2.39.2