From: Mircea Kitsune Date: Mon, 14 Feb 2011 16:39:01 +0000 (+0200) Subject: If we drop a weapon that's loaded, give the ammo back to the player. The player will... X-Git-Tag: xonotic-v0.5.0~309^2~7^2~16 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=cc7f2857061649324097221e0946b42e130a03f7 If we drop a weapon that's loaded, give the ammo back to the player. The player will then have to reload that weapon if he picks up another one of the same type. --- diff --git a/qcsrc/server/cl_weapons.qc b/qcsrc/server/cl_weapons.qc index 5271da0570..7b0bbce3c8 100644 --- a/qcsrc/server/cl_weapons.qc +++ b/qcsrc/server/cl_weapons.qc @@ -221,6 +221,13 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto wep.ammofield = thisammo; own.ammofield -= thisammo; s = strcat(s, " and ", ftos(thisammo), " ", Item_CounterFieldName(j)); + + // if our weapon is loaded, give its load back to the player + if(self.weapon_load[self.weapon] > 0) + { + own.ammofield += self.weapon_load[self.weapon]; + self.weapon_load[self.weapon] = -1; // schedule the weapon for reloading + } } } s = substring(s, 5, -1);