From: Mircea Kitsune Date: Tue, 12 Apr 2011 22:56:53 +0000 (+0300) Subject: Fix giving back ammo to the player if they drop the weapon while loading. This code... X-Git-Tag: xonotic-v0.5.0~263^2~10^2~16 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6b06fdda5f275989358af7f65974b0db7dbabf89;p=xonotic%2Fxonotic-data.pk3dir.git Fix giving back ammo to the player if they drop the weapon while loading. This code should also secure against other possible issues I think. --- diff --git a/qcsrc/server/w_hagar.qc b/qcsrc/server/w_hagar.qc index 5ccadbd8b..3ab783636 100644 --- a/qcsrc/server/w_hagar.qc +++ b/qcsrc/server/w_hagar.qc @@ -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