]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Only switch to another weapon if the current one doesn't have enough ammo loaded...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 22 Jan 2011 00:31:09 +0000 (02:31 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 22 Jan 2011 00:31:09 +0000 (02:31 +0200)
qcsrc/server/cl_weaponsystem.qc
qcsrc/server/w_crylink.qc
qcsrc/server/w_electro.qc
qcsrc/server/w_grenadelauncher.qc
qcsrc/server/w_hlac.qc
qcsrc/server/w_minelayer.qc
qcsrc/server/w_shotgun.qc
qcsrc/server/w_sniperrifle.qc
qcsrc/server/w_uzi.qc

index 0b23049fb113e717675c574b0aa879eaf36372b5..0f3edce251dc4a5abe3fb37131ad5a5f5e16462b 100644 (file)
@@ -1628,7 +1628,7 @@ void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread)
 
 // shared weapon reload code
 .float reload_complain;
-float W_ReloadCheck(float ammo_amount)
+float W_ReloadCheck(float ammo_amount, float ammo_shot)
 {
        entity e;
        e = get_weaponinfo(self.weapon);
@@ -1646,8 +1646,8 @@ float W_ReloadCheck(float ammo_amount)
                        sprint(self, strcat("You don't have enough ammo to reload the ^2", W_Name(self.weapon), "\n"));
                        self.reload_complain = time + 1;
                }
-               // is there's no more ammo to reload, only switch to another weapon if there's no more load in this one
-               if(!self.clip_load)
+               // switch away if the loaded amount of ammo is not enough to keep using the weapon
+               if(self.clip_load < ammo_shot)
                {
                        self.clip_load = -1; // reload later
                        W_SwitchToOtherWeapon(self);
index 54bbf3652e8f9b98dd03be0f111c06f1a0f1f404..604efbe1c1cd5ac3b0b83e5ae08b6ffa3786c6b8 100644 (file)
@@ -47,7 +47,7 @@ void W_Crylink_Reload()
        if(!autocvar_g_balance_crylink_reload_ammo)
                return;
 
-       if(!W_ReloadCheck(self.ammo_cells))
+       if(!W_ReloadCheck(self.ammo_cells, min(autocvar_g_balance_crylink_primary_ammo, autocvar_g_balance_crylink_secondary_ammo)))
                return;
 
        float t;
index 1b67d040895a0a116dcc726b3be72192f9e55ce1..c4cd72689843646e50a916b660850d4fc7215131 100644 (file)
@@ -43,7 +43,7 @@ void W_Electro_Reload()
        if(!autocvar_g_balance_electro_reload_ammo)
                return;
 
-       if(!W_ReloadCheck(self.ammo_cells))
+       if(!W_ReloadCheck(self.ammo_cells, min(autocvar_g_balance_electro_primary_ammo, autocvar_g_balance_electro_secondary_ammo)))
                return;
 
        float t;
index e803ac77f294dedf5f0a0f14232982032eda97d9..ddd5eacf499e4b5c4b071eccc9ae217565302c83 100644 (file)
@@ -43,7 +43,7 @@ void W_GrenadeLauncher_Reload()
        if(!autocvar_g_balance_grenadelauncher_reload_ammo)
                return;
 
-       if(!W_ReloadCheck(self.ammo_rockets))
+       if(!W_ReloadCheck(self.ammo_rockets, min(autocvar_g_balance_grenadelauncher_primary_ammo, autocvar_g_balance_grenadelauncher_secondary_ammo)))
                return;
 
        float t;
index 233e6d3371fc791dba7d7135ecb650e5eb0430fa..3a5ff0717cb203d313ca57929b1190cb7642950d 100644 (file)
@@ -41,7 +41,7 @@ void W_HLAC_Reload()
        if(!autocvar_g_balance_hlac_reload_ammo)
                return;
 
-       if(!W_ReloadCheck(self.ammo_cells))
+       if(!W_ReloadCheck(self.ammo_cells, min(autocvar_g_balance_hlac_primary_ammo, autocvar_g_balance_hlac_secondary_ammo)))
                return;
 
        float t;
index dfef721953d46ad2d95dc16d426733ff374d4155..d46342ccc25d19c9c24cfc3ec914ba8e6cd620be 100644 (file)
@@ -44,7 +44,7 @@ void W_MineLayer_Reload()
        if(!autocvar_g_balance_minelayer_reload_ammo)
                return;
 
-       if(!W_ReloadCheck(self.ammo_rockets))
+       if(!W_ReloadCheck(self.ammo_rockets, autocvar_g_balance_minelayer_ammo))
                return;
 
        float t;
index a8e4bb47c4e8c0286e59db57c7c710fde41c2314..acf65a1f98dbb71582f0b71f8597293dc998a970 100644 (file)
@@ -41,7 +41,7 @@ void W_Shotgun_Reload()
        if(!autocvar_g_balance_shotgun_reload_ammo)
                return;
 
-       if(!W_ReloadCheck(self.ammo_shells))
+       if(!W_ReloadCheck(self.ammo_shells, autocvar_g_balance_shotgun_primary_ammo))
                return;
 
        float t;
index 7cfea7d2a40f6e232820ba41ef85de519d0ac7d2..826aa8d8dce435f4dfc474974482e34aebe5b2b5 100644 (file)
@@ -45,7 +45,7 @@ void W_SniperRifle_Reload()
        if(!autocvar_g_balance_sniperrifle_reload_ammo)
                return;
 
-       if(!W_ReloadCheck(self.ammo_nails))
+       if(!W_ReloadCheck(self.ammo_nails, min(autocvar_g_balance_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo)))
                return;
 
        float t;
index a87513b8e17077f98c0214ae41d1f24751ae2695..a02175884d9f9dd1c76272e2586ffede03600e18 100644 (file)
@@ -41,7 +41,7 @@ void W_UZI_Reload()
        if(!autocvar_g_balance_uzi_reload_ammo)
                return;
 
-       if(!W_ReloadCheck(self.ammo_nails))
+       if(!W_ReloadCheck(self.ammo_nails, min(max(autocvar_g_balance_uzi_sustained_ammo, autocvar_g_balance_uzi_first_ammo), autocvar_g_balance_uzi_burst_ammo)))
                return;
 
        float t;