]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 5271da05706ba3adb64ece06a9c1ed98add1b9bd..7b0bbce3c8ff83ab2b4314ab087b252f5a10b30f 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);