From cc7f2857061649324097221e0946b42e130a03f7 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Mon, 14 Feb 2011 18:39:01 +0200 Subject: [PATCH] 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. --- qcsrc/server/cl_weapons.qc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qcsrc/server/cl_weapons.qc b/qcsrc/server/cl_weapons.qc index 5271da057..7b0bbce3c 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); -- 2.39.2