From: Rudolf Polzer Date: Wed, 14 Mar 2012 09:33:13 +0000 (+0100) Subject: fix a stupid interaction between weapon throwing and weapon load (loaded ammo was... X-Git-Tag: xonotic-v0.7.0~352 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0fba5175ee46ddb6b6d82eafcc6bf7cbe6334bf7;p=xonotic%2Fxonotic-data.pk3dir.git fix a stupid interaction between weapon throwing and weapon load (loaded ammo was not thrown) --- diff --git a/qcsrc/server/cl_weapons.qc b/qcsrc/server/cl_weapons.qc index 4a12ce185..94eaccd2d 100644 --- a/qcsrc/server/cl_weapons.qc +++ b/qcsrc/server/cl_weapons.qc @@ -262,7 +262,6 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto if(wa & j) { ammofield = Item_CounterField(j); - wep.ammofield = 0; // if our weapon is loaded, give its load back to the player if(self.(weapon_load[self.weapon]) > 0) @@ -270,6 +269,8 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto own.ammofield += self.(weapon_load[self.weapon]); self.(weapon_load[self.weapon]) = -1; // schedule the weapon for reloading } + + wep.ammofield = 0; } } } @@ -280,10 +281,6 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto if(wa & j) { ammofield = Item_CounterField(j); - thisammo = min(own.ammofield, wep.ammofield); - 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) @@ -291,6 +288,11 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto own.ammofield += self.(weapon_load[self.weapon]); self.(weapon_load[self.weapon]) = -1; // schedule the weapon for reloading } + + thisammo = min(own.ammofield, wep.ammofield); + wep.ammofield = thisammo; + own.ammofield -= thisammo; + s = strcat(s, " and ", ftos(thisammo), " ", Item_CounterFieldName(j)); } } s = substring(s, 5, -1); diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index b26c840ff..1e9d6a753 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -379,8 +379,6 @@ float Item_GiveTo(entity item, entity player) if (item.weapons & WEPBIT_MINSTANEX) W_GiveWeapon (player, WEP_MINSTANEX, item.netname); - if (item.ammo_cells) - player.ammo_cells = bound(player.ammo_cells, 999, player.ammo_cells + autocvar_g_minstagib_ammo_drop); player.health = 100; } @@ -1102,6 +1100,11 @@ void weapon_defaultspawnfunc(float wpn) if(self.team) f |= FL_NO_WEAPON_STAY; + // stupid minstagib hack, don't ask + if(g_minstagib) + if(self.ammo_cells) + self.ammo_cells = autocvar_g_minstagib_ammo_drop; + StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, self.respawntimejitter, e.message, 0, e.weapons, f, weapon_pickupevalfunc, e.bot_pickupbasevalue); if (self.modelindex) // don't precache if self was removed weapon_action(e.weapon, WR_PRECACHE);