#include <common/util.qh>
#include <common/weapons/_all.qh>
#include <common/state.qh>
+#include <common/wepent.qh>
void thrown_wep_think(entity this)
{
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;
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;
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);
}