From: Rudolf Polzer Date: Sat, 15 Jan 2011 17:56:08 +0000 (+0100) Subject: fix weapon throwing X-Git-Tag: xonotic-v0.5.0~318^2~108 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=103a48bb805d63e5e49847822eee78adb5acc8c8 fix weapon throwing --- diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index bac718356b..ca0b2d4a16 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -325,11 +325,14 @@ void SpawnThrownWeapon (vector org, float w) { if(self.weapons & W_WeaponBit(j)) if(W_IsWeaponThrowable(j)) - W_ThrowNewWeapon(self, j, FALSE, self.origin, randomvec() * 175 + '0 0 325'); + W_ThrowNewWeapon(self, j, FALSE, org, randomvec() * 175 + '0 0 325'); } } else - W_ThrowWeapon(randomvec() * 125 + '0 0 200', org - self.origin, FALSE); + { + if(W_IsWeaponThrowable(self.weapon)) + W_ThrowNewWeapon(self, self.weapon, FALSE, org, randomvec() * 125 + '0 0 200'); + } } void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) diff --git a/qcsrc/server/cl_weapons.qc b/qcsrc/server/cl_weapons.qc index 17190326f8..864dd77fce 100644 --- a/qcsrc/server/cl_weapons.qc +++ b/qcsrc/server/cl_weapons.qc @@ -234,6 +234,20 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto float W_IsWeaponThrowable(float w) { float wb, wa; + + if (!autocvar_g_pickup_items) + return 0; + if (g_weaponarena) + return 0; + if (g_lms) + return 0; + if (g_ca) + return 0; + if (g_cts) + return 0; + if (g_nexball && w == WEP_GRENADE_LAUNCHER) + return 0; + wb = W_WeaponBit(w); if(!wb) return 0; @@ -263,25 +277,13 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce) return; // just in case if(MUTATOR_CALLHOOK(ForbidThrowCurrentWeapon)) return; - if (g_weaponarena) - return; - if (g_lms) - return; - if (g_nexball && w == WEP_GRENADE_LAUNCHER) - return; - if (!autocvar_g_pickup_items) - return; - if (g_ca) - return; - if (g_cts) - return; if(!autocvar_g_weapon_throwable) return; if(autocvar_g_weapon_stay == 1) return; - if(!W_IsWeaponThrowable(w)) + if(self.weaponentity.state != WS_READY) return; - if(self.deadflag == DEAD_NO && self.weaponentity.state != WS_READY) + if(!W_IsWeaponThrowable(w)) return; wb = W_WeaponBit(w); @@ -293,13 +295,10 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce) a = W_ThrowNewWeapon(self, w, doreduce, self.origin + delta, velo); if not(a) return; - if(self.health >= 1) - { - if(a == "") - sprint(self, strcat("You dropped the ^2", W_Name(w), "\n")); - else - sprint(self, strcat("You dropped the ^2", W_Name(w), " with ", a, "\n")); - } + if(a == "") + sprint(self, strcat("You dropped the ^2", W_Name(w), "\n")); + else + sprint(self, strcat("You dropped the ^2", W_Name(w), " with ", a, "\n")); }; // Bringed back weapon frame