]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use the new ammo function for laser and hook too (tested)
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 11 Feb 2011 16:45:30 +0000 (18:45 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 11 Feb 2011 16:45:30 +0000 (18:45 +0200)
qcsrc/server/w_hook.qc
qcsrc/server/w_laser.qc

index 8c4cfc897a3e681ef4121f6493013837a2eedbc1..4ce665dc7d7fe74e4312e66917224b92ca470384 100644 (file)
@@ -69,7 +69,7 @@ void W_Hook_Attack2()
        local entity gren;
 
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
-               self.ammo_cells = self.ammo_cells - autocvar_g_balance_hook_secondary_ammo;
+               W_DecreaseAmmo(ammo_cells, autocvar_g_balance_hook_secondary_ammo, FALSE);
        W_SetupShot (self, FALSE, 4, "weapons/hookbomb_fire.wav", CHAN_WEAPON, autocvar_g_balance_hook_secondary_damage);
 
        gren = spawn ();
@@ -133,7 +133,7 @@ float w_hook(float req)
                        if (weapon_prepareattack(0, -1))
                        {
                                if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
-                                       self.ammo_fuel = self.ammo_fuel - autocvar_g_balance_hook_primary_fuel;
+                                       W_DecreaseAmmo(ammo_fuel, autocvar_g_balance_hook_primary_fuel, FALSE);
                                self.hook_state |= HOOK_FIRING;
                                weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_hook_primary_animtime, w_ready);                         
                        }
@@ -176,7 +176,7 @@ float w_hook(float req)
                                        {
                                                if ( self.ammo_fuel >= (time - self.hook_time_fueldecrease) * hooked_fuel )
                                                {
-                                                       self.ammo_fuel -= (time - self.hook_time_fueldecrease) * hooked_fuel;
+                                                       W_DecreaseAmmo(ammo_fuel, (time - self.hook_time_fueldecrease) * hooked_fuel, FALSE);
                                                        self.hook_time_fueldecrease = time;
                                                        // decrease next frame again
                                                }
index 749b0523d43888be6d21e4b6f687fb60ba4a9654..ad29d442a0566bebc9571c920d0aa4e6eb57defa 100644 (file)
@@ -232,15 +232,7 @@ float w_laser(float req)
                {
                        if (weapon_prepareattack(0, autocvar_g_balance_laser_primary_refire))
                        {
-                               // if this weapon is reloadable, decrease its load
-                               if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
-                               {
-                                       if(autocvar_g_balance_laser_reload_ammo)
-                                       {
-                                               self.clip_load -= 1;
-                                               self.weapon_load[WEP_LASER] = self.clip_load;
-                                       }
-                               }
+                               W_DecreaseAmmo(zero_ammo, 1, TRUE);
 
                                W_Laser_Attack(0);
                                weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_laser_primary_animtime, w_ready);
@@ -250,15 +242,7 @@ float w_laser(float req)
                {
                        if(autocvar_g_balance_laser_secondary)
                        {
-                               // if this weapon is reloadable, decrease its load
-                               if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
-                               {
-                                       if(autocvar_g_balance_laser_reload_ammo)
-                                       {
-                                               self.clip_load -= 1;
-                                               self.weapon_load[WEP_LASER] = self.clip_load;
-                                       }
-                               }
+                               W_DecreaseAmmo(zero_ammo, 1, TRUE);
 
                                if (weapon_prepareattack(0, 0))
                                {