if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
self.weapon_load[j] = cvar(strcat("g_balance_", e.netname, "_reload_ammo"));
}
+ self.weapon_forbidchange = FALSE;
oldself = self;
self = spot;
w = self.weapon;
if (w == 0)
return; // just in case
+ if(self.weapon_forbidchange)
+ return;
if(MUTATOR_CALLHOOK(ForbidThrowCurrentWeapon))
return;
if(!autocvar_g_weapon_throwable)
if(!W_IsWeaponThrowable(w))
return;
- // don't allow throwing the hager if we're loading rockets into it
- if(self.weapon == WEP_HAGAR && self.hagar_load)
- return;
-
wb = W_WeaponBit(w);
if(self.weapons & wb != wb)
return;
void W_SwitchWeapon_Force(entity e, float w)
{
- // don't allow switching to another weapon if we're loading rockets into the hagar
- if(e.weapon == WEP_HAGAR && e.hagar_load)
- if(e.weapons & WEPBIT_HAGAR) // only if we still have the hagar, prevents a bug with dropping
+ // don't switch to another weapon if we're not allowed to
+ if(e.weapon_forbidchange)
return;
e.cnt = e.switchweapon;
// VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies)
.float weapon_nextthink;
.void() weapon_think;
+.float weapon_forbidchange;
//float PLAYER_WEAPONSELECTION_DELAY = );
float PLAYER_WEAPONSELECTION_SPEED = 18;
}
if(self.hagar_load)
- if(!self.BUTTON_ATCK2 || ((loaded || !weapon_action(self.weapon, WR_CHECKAMMO2)) && self.hagar_loadstep < time && !autocvar_g_balance_hagar_secondary_load_hold))
- W_Hagar_Attack2_Load_Release();
+ {
+ self.weapon_forbidchange = TRUE;
+
+ if(!self.BUTTON_ATCK2 || ((loaded || !weapon_action(self.weapon, WR_CHECKAMMO2)) && self.hagar_loadstep < time && !autocvar_g_balance_hagar_secondary_load_hold))
+ W_Hagar_Attack2_Load_Release();
+ }
+ else
+ self.weapon_forbidchange = FALSE;
// we aren't checking ammo during an attack, so we must do it here
if not(weapon_action(self.weapon, WR_CHECKAMMO2))