]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix switching to the shotgun with no ammo when melee is active. Also improve another...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 24 Jan 2011 00:23:28 +0000 (02:23 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 24 Jan 2011 00:23:28 +0000 (02:23 +0200)
qcsrc/server/cl_weaponsystem.qc
qcsrc/server/w_shotgun.qc

index 91450dd2b1ae6545a5d42471d03a7923dd7fdb5c..f2c4447faeeec9298f6223158fa5054f94b58c40 100644 (file)
@@ -1631,8 +1631,8 @@ float W_ReloadCheck(float ammo_amount, float ammo_shot)
                        sprint(self, strcat("You don't have enough ammo to reload the ^2", W_Name(self.weapon), "\n"));
                        self.reload_complain = time + 1;
                }
-               // switch away if the loaded amount of ammo is not enough to keep using this weapon
-               if(self.clip_load < ammo_shot)
+               // switch away if the amount of ammo is not enough to keep using this weapon
+               if not(weapon_action(self.weapon, WR_CHECKAMMO1) + weapon_action(self.weapon, WR_CHECKAMMO2))
                {
                        self.clip_load = -1; // reload later
                        W_SwitchToOtherWeapon(self);
index fa398933b38671ecf94a2fd7f7b39c7eb1ba03a7..3f5a91edea8c69aa5629c2931e828c83a3f673d2 100644 (file)
@@ -176,7 +176,11 @@ float w_shotgun(float req)
        else if (req == WR_THINK)
        {
                if(autocvar_g_balance_shotgun_reload_ammo && self.clip_load < autocvar_g_balance_shotgun_primary_ammo) // forced reload
-                       W_Shotgun_Reload();
+               {
+                       // don't force reload an empty shotgun if its melee attack is active
+                       if not(autocvar_g_balance_shotgun_secondary && self.ammo_shells < autocvar_g_balance_shotgun_primary_ammo)
+                               W_Shotgun_Reload();
+               }
                else
                {
                        if (self.BUTTON_ATCK)
@@ -191,12 +195,12 @@ float w_shotgun(float req)
                                        }
                                }
                        }
-                       if (self.BUTTON_ATCK2 && autocvar_g_balance_shotgun_secondary)
-                       if (weapon_prepareattack(1, autocvar_g_balance_shotgun_secondary_refire))
-                       {
-                               // attempt forcing playback of the anim by switching to another anim (that we never play) here...
-                               weapon_thinkf(WFRAME_FIRE1, 0, W_Shotgun_Attack2);
-                       }
+               }
+               if (self.BUTTON_ATCK2 && autocvar_g_balance_shotgun_secondary)
+               if (weapon_prepareattack(1, autocvar_g_balance_shotgun_secondary_refire))
+               {
+                       // attempt forcing playback of the anim by switching to another anim (that we never play) here...
+                       weapon_thinkf(WFRAME_FIRE1, 0, W_Shotgun_Attack2);
                }
        }
        else if (req == WR_PRECACHE)