From c2afbf519433fb56c9b8b807ca3ab12c62575ec8 Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Sun, 21 Oct 2018 00:32:57 +0200 Subject: [PATCH] option to not reload by weapswitch and not fallback to other weaps from the impulse --- qcsrc/server/weapons/selection.qc | 6 ++++-- xonotic-client.cfg | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 5912261db..b4c13851b 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -266,6 +266,7 @@ void W_SwitchToOtherWeapon(entity this, .entity weaponentity) W_SwitchWeapon_Force(this, ww, weaponentity); } +AUTOCVAR_SAVE(cl_weapon_switch_reload, bool, true, "When trying to switch to the currently held weapon, reload it"); bool W_SwitchWeapon(entity this, Weapon w, .entity weaponentity) { if(this.(weaponentity).m_switchweapon != w) @@ -281,7 +282,7 @@ bool W_SwitchWeapon(entity this, Weapon w, .entity weaponentity) return false; } } - else if(!forbidWeaponUse(this)) + else if(!forbidWeaponUse(this) && autocvar_cl_weapon_switch_reload) { entity actor = this; w.wr_reload(w, actor, weaponentity); @@ -290,9 +291,10 @@ bool W_SwitchWeapon(entity this, Weapon w, .entity weaponentity) return true; // player already has the weapon out or needs to reload } +AUTOCVAR_SAVE(cl_weapon_switch_fallback_to_impulse, bool, true, "When trying to switch to a weapon that is not available, switch to an alternative from the same impulse"); void W_SwitchWeapon_TryOthers(entity this, Weapon w, .entity weaponentity) { - if(!W_SwitchWeapon(this, w, weaponentity)) + if(!W_SwitchWeapon(this, w, weaponentity) && autocvar_cl_weapon_switch_fallback_to_impulse) W_NextWeaponOnImpulse(this, w.impulse, weaponentity); } diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 3f9baf571..280e9b1e3 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -60,6 +60,9 @@ seta cl_unpress_zoom_on_death 1 "automatically unpress zoom when you die (and do 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 -- 2.39.2