]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/throwing.qc
Merge branch 'master' into Mario/wepent_experimental
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / throwing.qc
index 10fead1a610099dfcfdfb879a3d47675c656033c..4114c3c58b199cc9a950c811dcf5269b0fdea807 100644 (file)
@@ -11,6 +11,7 @@
 #include <common/util.qh>
 #include <common/weapons/_all.qh>
 #include <common/state.qh>
+#include <common/wepent.qh>
 
 void thrown_wep_think(entity this)
 {
@@ -138,7 +139,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
 
 bool W_IsWeaponThrowable(entity this, int w)
 {
-       if (MUTATOR_CALLHOOK(ForbidDropCurrentWeapon, this))
+       if (MUTATOR_CALLHOOK(ForbidDropCurrentWeapon, this, w))
                return false;
        if (!autocvar_g_pickup_items)
                return false;
@@ -170,7 +171,7 @@ void W_ThrowWeapon(entity this, .entity weaponentity, vector velo, vector delta,
        Weapon w = this.(weaponentity).m_weapon;
        if (w == WEP_Null)
                return; // just in case
-       if(MUTATOR_CALLHOOK(ForbidThrowCurrentWeapon, this))
+       if(MUTATOR_CALLHOOK(ForbidThrowCurrentWeapon, this, this.(weaponentity)))
                return;
        if(!autocvar_g_weapon_throwable)
                return;
@@ -192,7 +193,9 @@ void W_ThrowWeapon(entity this, .entity weaponentity, vector velo, vector delta,
 
 void SpawnThrownWeapon(entity this, vector org, float w, .entity weaponentity)
 {
-       if(this.weapons & WepSet_FromWeapon(this.(weaponentity).m_weapon))
-               if(W_IsWeaponThrowable(this, this.(weaponentity).m_weapon.m_id))
-                       W_ThrowNewWeapon(this, this.(weaponentity).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200', weaponentity);
+       entity wep = this.(weaponentity).m_weapon;
+
+       if(this.weapons & WepSet_FromWeapon(wep))
+               if(W_IsWeaponThrowable(this, wep.m_id))
+                       W_ThrowNewWeapon(this, wep.m_id, false, org, randomvec() * 125 + '0 0 200', weaponentity);
 }