If we drop a weapon that's loaded, give the ammo back to the player. The player will...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 14 Feb 2011 16:39:01 +0000 (18:39 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 14 Feb 2011 16:39:01 +0000 (18:39 +0200)
qcsrc/server/cl_weapons.qc

index 5271da0..7b0bbce 100644 (file)
@@ -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);