Option to not reload by weapswitch and not fallback to other weaps from the impulse
See merge request xonotic/xonotic-data.pk3dir!616
registercvar("cl_spawn_near_teammate", "1");
+ registercvar("cl_weapon_switch_reload", "1");
+ registercvar("cl_weapon_switch_fallback_to_impulse", "1");
+
if(autocvar_cl_lockview)
cvar_set("cl_lockview", "0");
ATTRIBARRAY(Client, cvar_cl_weaponpriorities, string, 10);
ATTRIB(Client, cvar_cl_weaponpriority, string, this.cvar_cl_weaponpriority);
ATTRIB(Client, cvar_cl_cts_noautoswitch, bool, this.cvar_cl_cts_noautoswitch);
+ ATTRIB(Client, cvar_cl_weapon_switch_reload, bool, this.cvar_cl_weapon_switch_reload);
+ ATTRIB(Client, cvar_cl_weapon_switch_fallback_to_impulse, bool, this.cvar_cl_weapon_switch_fallback_to_impulse);
METHOD(Client, m_unwind, bool(Client this));
.float cvar_cl_movement_track_canjump;
.float cvar_cl_newusekeysupported;
.float cvar_cl_cts_noautoswitch;
+.bool cvar_cl_weapon_switch_reload;
+.bool cvar_cl_weapon_switch_fallback_to_impulse;
.string cvar_g_xonoticversion;
.string cvar_cl_weaponpriority;
REPLICATE(cvar_cl_cts_noautoswitch, bool, "cl_cts_noautoswitch");
+REPLICATE(cvar_cl_weapon_switch_reload, bool, "cl_weapon_switch_reload");
+
+REPLICATE(cvar_cl_weapon_switch_fallback_to_impulse, bool, "cl_weapon_switch_fallback_to_impulse");
+
/**
* @param f -1: cleanup, 0: request, 1: receive
*/
return false;
}
}
- else if(!forbidWeaponUse(this))
+ else if(!forbidWeaponUse(this) && CS(this).cvar_cl_weapon_switch_reload)
{
entity actor = this;
w.wr_reload(w, actor, weaponentity);
void W_SwitchWeapon_TryOthers(entity this, Weapon w, .entity weaponentity)
{
- if(!W_SwitchWeapon(this, w, weaponentity))
+ if(!W_SwitchWeapon(this, w, weaponentity) && CS(this).cvar_cl_weapon_switch_fallback_to_impulse)
W_NextWeaponOnImpulse(this, w.impulse, weaponentity);
}
seta cl_unpress_zoom_on_weapon_switch 1 "automatically unpress zoom when you switch a weapon"
seta cl_unpress_attack_on_weapon_switch 0 "automatically unpress fire and fire1 attack buttons when you switch a weapon"
+seta cl_weapon_switch_reload 1 "When trying to switch to the currently held weapon, reload it"
+seta cl_weapon_switch_fallback_to_impulse 1 "When trying to switch to a weapon that is not available, switch to an alternative from the same impulse"
+
seta cl_spawn_event_particles 1 "pointparticles effect whenever a player spawns"
seta cl_spawn_event_sound 1 "sound effect whenever a player spawns"
//seta cl_spawn_point_model 0 "place a model at all spawn points" // still needs a model