Properly check if we have enough ammo for an attack
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 16 Jul 2011 11:50:05 +0000 (14:50 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 16 Jul 2011 11:50:05 +0000 (14:50 +0300)
data/qcsrc/server/w_grabber.qc

index 5259890..a41c01f 100644 (file)
@@ -213,20 +213,26 @@ float w_grabber(float req)
        {\r
                if(self.grabber)\r
                {\r
-                       ammo_amount = self.ammo_fuel > 0;\r
-                       ammo_amount += self.weapon_load[WEP_GRABBER] > 0;\r
+                       if(cvar("g_balance_grabber_reload_ammo"))\r
+                               ammo_amount = self.weapon_load[WEP_GRABBER] > 0;\r
+                       else\r
+                               ammo_amount = self.ammo_fuel > 0;\r
                }\r
                else\r
                {\r
-                       ammo_amount = self.ammo_fuel >= cvar("g_balance_grabber_primary_ammo");\r
-                       ammo_amount += self.weapon_load[WEP_GRABBER] >= cvar("g_balance_grabber_primary_ammo");\r
+                       if(cvar("g_balance_grabber_reload_ammo"))\r
+                               ammo_amount = self.weapon_load[WEP_GRABBER] >= cvar("g_balance_grabber_primary_ammo");\r
+                       else\r
+                               ammo_amount = self.ammo_fuel >= cvar("g_balance_grabber_primary_ammo");\r
                }\r
                return ammo_amount;\r
        }\r
        else if (req == WR_CHECKAMMO2)\r
        {\r
-               ammo_amount = self.ammo_fuel >= cvar("g_balance_grabber_secondary_ammo");\r
-               ammo_amount += self.weapon_load[WEP_GRABBER] >= cvar("g_balance_grabber_secondary_ammo");\r
+               if(cvar("g_balance_grabber_reload_ammo"))\r
+                       ammo_amount = self.weapon_load[WEP_GRABBER] >= cvar("g_balance_grabber_secondary_ammo");\r
+               else\r
+                       ammo_amount = self.ammo_fuel >= cvar("g_balance_grabber_secondary_ammo");\r
                return ammo_amount;\r
        }\r
        else if (req == WR_RELOAD)\r