From: terencehill Date: Mon, 8 Aug 2022 23:00:46 +0000 (+0200) Subject: Reloadable shotgun: when clip is empty automatically reload regardless of whether... X-Git-Tag: xonotic-v0.8.6~357^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b62d65bbddcc6b00929f09d4cb0cbd474e356174;p=xonotic%2Fxonotic-data.pk3dir.git Reloadable shotgun: when clip is empty automatically reload regardless of whether melee attack is available or not, and make sure player has some some ammo left Note: WEP_CVAR(shotgun, secondary) < 2 check was wrong because it included secondary mode 0 where secondary attack is off --- diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 523de5d71..e43aa89aa 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -203,11 +203,13 @@ METHOD(Shotgun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity) METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - if(WEP_CVAR(shotgun, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(shotgun, ammo)) // forced reload + // force reload weapon when clip is empty or insufficent + if(WEP_CVAR(shotgun, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(shotgun, ammo)) { - // don't force reload an empty shotgun if its melee attack is active - if(WEP_CVAR(shotgun, secondary) < 2) { + if(actor.(weaponentity).clip_load >= 0 && GetResource(actor, thiswep.ammo_type) > 0) + { thiswep.wr_reload(thiswep, actor, weaponentity); + return; } } else