]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
option to not reload by weapswitch and not fallback to other weaps from the impulse
authorMartin Taibr <taibr.martin@gmail.com>
Sat, 20 Oct 2018 22:32:57 +0000 (00:32 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Sat, 20 Oct 2018 22:32:57 +0000 (00:32 +0200)
qcsrc/server/weapons/selection.qc
xonotic-client.cfg

index 5912261dbf68cf6bca6a47ce8e86db480c2cd2b9..b4c13851bf47514c57a0212e5d2df0e0a4bcc627 100644 (file)
@@ -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);
 }
 
index 3f9baf571bb2f56366bbeb2c511110ec486a1042..280e9b1e3ea7ddb76d135d6c7382d8fccd3651f2 100644 (file)
@@ -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