]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - defaultXonotic.cfg
More cosmetic changes to the script
[xonotic/xonotic-data.pk3dir.git] / defaultXonotic.cfg
index 4629e78fa6a195ee1d7c9aece0e435e5b9d33047..fd6f2da3453dabaadc1146972ad18c1748d50433 100644 (file)
@@ -1493,23 +1493,23 @@ seta cl_weaponpriority8 "" "use impulse 208 for prev gun from this list, 218 for
 seta cl_weaponpriority9 "" "use impulse 209 for prev gun from this list, 219 for best gun, 229 for next gun"
 seta cl_weaponimpulsemode 0 "0: only cycle between currently usable weapons in weapon priority order; 1: cycle between all possible weapons on a key in weapon priority order"
 
-seta cl_reversefirebuttons_tuba 0
-seta cl_reversefirebuttons_laser 0
-seta cl_reversefirebuttons_shotgun 0
-seta cl_reversefirebuttons_uzi 0
-seta cl_reversefirebuttons_campingrifle 0
-seta cl_reversefirebuttons_grenadelauncher 0
-seta cl_reversefirebuttons_electro 0
-seta cl_reversefirebuttons_hlac 0
-seta cl_reversefirebuttons_crylink 0
-seta cl_reversefirebuttons_minstanex 0
-seta cl_reversefirebuttons_nex 0
-seta cl_reversefirebuttons_hagar 0
-seta cl_reversefirebuttons_seeker 0
-seta cl_reversefirebuttons_fireball 0
-seta cl_reversefirebuttons_rocketlauncher 0
-seta cl_reversefirebuttons_hook 0
-seta cl_reversefirebuttons_porto 0
+seta cl_swapattacks_tuba 0
+seta cl_swapattacks_laser 0
+seta cl_swapattacks_shotgun 0
+seta cl_swapattacks_uzi 0
+seta cl_swapattacks_campingrifle 0
+seta cl_swapattacks_grenadelauncher 0
+seta cl_swapattacks_electro 0
+seta cl_swapattacks_hlac 0
+seta cl_swapattacks_crylink 0
+seta cl_swapattacks_minstanex 0
+seta cl_swapattacks_nex 0
+seta cl_swapattacks_hagar 0
+seta cl_swapattacks_seeker 0
+seta cl_swapattacks_fireball 0
+seta cl_swapattacks_rocketlauncher 0
+seta cl_swapattacks_hook 0
+seta cl_swapattacks_porto 0
 
 seta sv_status_privacy 1       "hide IP addresses from \"status\" replies shown to clients"
 
@@ -1530,12 +1530,28 @@ alias _gl_flashblend_update_01 "gl_flashblend 0"
 alias _gl_flashblend_update_11 "gl_flashblend 0"
 alias gl_flashblend_update "_gl_flashblend_update_$r_shadow_realtime_dlight$r_showsurfaces"
 
-alias firing_decision_0 "alias +preattack +attack; alias -preattack -attack; alias +preattack2 +attack2; alias -preattack2 -attack2"
-alias firing_decision_1 "alias +preattack +attack2; alias -preattack -attack2; alias +preattack2 +attack; alias -preattack2 -attack"
+// this script allows swapping the primary and secondary fire buttons for any weapon, using the cl_swapattacks_* cvars.
+// This part of the code is necessary to keep us firing when we switch weapons while holding a fire button pressed.
+// Also updates the keys before firing, so we don't have to switch to another weapon and back to apply the changes
+set preattack_last 0
+set preattack2_last 0
+alias +preattack "firing_swap2 $firing_lastweapon; set preattack_last 1; +checkattack"
+alias -preattack "firing_swap2 $firing_lastweapon; set preattack_last 0; -checkattack"
+alias +preattack2 "firing_swap2 $firing_lastweapon; set preattack2_last 1; +checkattack2"
+alias -preattack2 "firing_swap2 $firing_lastweapon; set preattack2_last 0; -checkattack2"
+alias firing_switch_attack_0 ""
+alias firing_switch_attack2_0 ""
+alias firing_switch_attack_1 "+preattack"
+alias firing_switch_attack2_1 "+preattack2"
+alias firing_switch "-preattack; -preattack2; firing_switch_attack_$preattack_last; firing_switch_attack2_$preattack2_last;"
+// now apply changes to the key binds and get the weapon we are using
+alias firing_decision_0 "alias +checkattack +attack; alias -checkattack -attack; alias +checkattack2 +attack2; alias -checkattack2 -attack2"
+alias firing_decision_1 "alias +checkattack +attack2; alias -checkattack -attack2; alias +checkattack2 +attack; alias -checkattack2 -attack"
 alias firing_swap2 "firing_decision_${$1}"
-alias firing_swap "firing_swap2 cl_reversefirebuttons_$1;"
+alias firing_swap "firing_swap2 cl_swapattacks_$1; set firing_lastweapon cl_swapattacks_$1; firing_switch"
+
+// this hook activates when we switch weapons, and allows us to script weapon specific properties (like the fire button swapping script)
 alias cl_hook_activeweapon "firing_swap $1"
-//alias +preattack "cl_hook_weapon; cl_fireswapping_$1"
 
 set sv_clones 0        "number of clones a player may make (reset by the \"kill\" command)"