]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/shotgun.qc
Reloadable shotgun: when clip is empty automatically reload regardless of whether...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / shotgun.qc
index 523de5d71b3f40dd3320d5a1b6e04e37ac4f712a..e43aa89aa16344a928276c65eb6d729c95e763e0 100644 (file)
@@ -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