]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix giving back ammo to the player if they drop the weapon while loading. This code...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 12 Apr 2011 22:56:53 +0000 (01:56 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 12 Apr 2011 22:56:53 +0000 (01:56 +0300)
qcsrc/server/w_hagar.qc

index 5ccadbd8bc69b52f83805a9370292c5063a13ce9..3ab7836369e86fad12edb76686243343db17ee94 100644 (file)
@@ -301,7 +301,12 @@ float w_hagar(float req)
        {
                weapon_setup(WEP_HAGAR);
                self.current_ammo = ammo_rockets;
-               self.hagar_load = 0;
+
+               if(self.hagar_load)
+               {
+                       W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_hagar_secondary_ammo * self.hagar_load * -1, autocvar_g_balance_hagar_reload_ammo); // give back ammo if necessary
+                       self.hagar_load = 0;
+               }
        }
        else if (req == WR_CHECKAMMO1)
        {
@@ -315,6 +320,10 @@ float w_hagar(float req)
                ammo_amount += self.weapon_load[WEP_HAGAR] >= autocvar_g_balance_hagar_secondary_ammo;
                return ammo_amount;
        }
+       else if (req == WR_RESETPLAYER)
+       {
+               self.hagar_load = 0;
+       }
        else if (req == WR_PLAYERDEATH)
        {
                // if we have any rockets loaded when we die, release them