for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) \
{ \
.entity weaponentity = weaponentities[slot]; \
- W_SwitchWeapon(this, Weapons_from(WEP_FIRST + i), weaponentity); \
+ W_SwitchWeapon_TryOthers(this, Weapons_from(WEP_FIRST + i), weaponentity); \
if(slot == 0 && autocvar_g_weaponswitch_debug != 1) \
break; \
} \
}
}
+void W_SwitchWeapon_TryOthers(entity this, Weapon w, .entity weaponentity)
+{
+ if(this.(weaponentity).m_switchweapon != w)
+ {
+ if(client_hasweapon(this, w, weaponentity, true, true)) // NOTE: still complains
+ W_SwitchWeapon_Force(this, w, weaponentity);
+ else
+ {
+ this.(weaponentity).selectweapon = w.m_id; // update selectweapon anyway
+ W_NextWeaponOnImpulse(this, w.impulse, weaponentity);
+ }
+ }
+ else if(!forbidWeaponUse(this))
+ {
+ entity actor = this;
+ w.wr_reload(w, actor, weaponentity);
+ }
+}
+
void W_CycleWeapon(entity this, string weaponorder, float dir, .entity weaponentity)
{
float w;
// perform weapon to attack (weaponstate and attack_finished check is here)
void W_SwitchToOtherWeapon(entity this, .entity weaponentity);
void W_SwitchWeapon(entity this, Weapon imp, .entity weaponentity);
+void W_SwitchWeapon_TryOthers(entity this, Weapon imp, .entity weaponentity);
void W_CycleWeapon(entity this, string weaponorder, float dir, .entity weaponentity);