]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix weapon throwing
authorRudolf Polzer <divverent@alientrap.org>
Sat, 15 Jan 2011 17:56:08 +0000 (18:56 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 15 Jan 2011 17:56:08 +0000 (18:56 +0100)
qcsrc/server/cl_player.qc
qcsrc/server/cl_weapons.qc

index bac718356b2ad1b580db3de71bc772ebbdc58067..ca0b2d4a16f0753e9e7529d7d7f4268a3b277b53 100644 (file)
@@ -325,11 +325,14 @@ void SpawnThrownWeapon (vector org, float w)
                {
                        if(self.weapons & W_WeaponBit(j))
                                if(W_IsWeaponThrowable(j))
                {
                        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
                }
        }
        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)
 }
 
 void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
index 17190326f85daf322c5ec9ab3aa4dadf77c4b618..864dd77fce788cc1696e7bbdee82ac3309748a89 100644 (file)
@@ -234,6 +234,20 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
 float W_IsWeaponThrowable(float w)
 {
        float wb, wa;
 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;
        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;
                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(!autocvar_g_weapon_throwable)
                return;
        if(autocvar_g_weapon_stay == 1)
                return;
-       if(!W_IsWeaponThrowable(w))
+       if(self.weaponentity.state != WS_READY)
                return;
                return;
-       if(self.deadflag == DEAD_NO && self.weaponentity.state != WS_READY)
+       if(!W_IsWeaponThrowable(w))
                return;
 
        wb = W_WeaponBit(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;
        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
 };
 
 // Bringed back weapon frame