From 82f6e14f63efc6895f69d12ee0f3198d17e7dbd7 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Fri, 2 Jul 2010 14:22:18 +0300 Subject: [PATCH] Move the script to its own config file, as suggested by divVerent --- defaultXonotic.cfg | 24 +++++------------------- script_swapattacks.cfg | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 script_swapattacks.cfg diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 2fe6bb36a..7a5779c74 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -914,6 +914,10 @@ alias sv_loadconfig "exec $serverconfig" alias sv_restart "say \"Server will restart at the end of the match, you will all be reconnected automatically. $* \"; quit_and_redirect self" // aliases: +alias +fire +attack +alias -fire -attack +alias +fire2 +attack2 +alias -fire2 -attack2 alias +attack2 +button3 alias -attack2 -button3 alias +zoom +button4 @@ -1534,25 +1538,7 @@ 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" -// 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 fire_last 0 -set fire2_last 0 -alias +fire "firing_swap_apply $firing_lastweapon; set fire_last 1; +checkattack" -alias -fire "set fire_last 0; -checkattack" -alias +fire2 "firing_swap_apply $firing_lastweapon; set fire2_last 1; +checkattack2" -alias -fire2 "set fire2_last 0; -checkattack2" -alias firing_switch_attack_0 "" -alias firing_switch_attack2_0 "" -alias firing_switch_attack_1 "+fire" -alias firing_switch_attack2_1 "+fire2" -alias firing_switch "-fire; -fire2; firing_switch_attack_$fire_last; firing_switch_attack2_$fire2_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_swap_apply "firing_decision_${$1}" -alias firing_swap "firing_swap_apply cl_swapattacks_$1; set firing_lastweapon cl_swapattacks_$1; firing_switch" +alias firing_swap "" // this script is located in its own config file // 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" diff --git a/script_swapattacks.cfg b/script_swapattacks.cfg new file mode 100644 index 000000000..4a676a7fb --- /dev/null +++ b/script_swapattacks.cfg @@ -0,0 +1,19 @@ +// 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 fire_last 0 +set fire2_last 0 +alias +fire "firing_swap_apply $firing_lastweapon; set fire_last 1; +checkattack" +alias -fire "set fire_last 0; -checkattack" +alias +fire2 "firing_swap_apply $firing_lastweapon; set fire2_last 1; +checkattack2" +alias -fire2 "set fire2_last 0; -checkattack2" +alias firing_switch_attack_0 "" +alias firing_switch_attack2_0 "" +alias firing_switch_attack_1 "+fire" +alias firing_switch_attack2_1 "+fire2" +alias firing_switch "-fire; -fire2; firing_switch_attack_$fire_last; firing_switch_attack2_$fire2_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_swap_apply "firing_decision_${$1}" +alias firing_swap "firing_swap_apply cl_swapattacks_$1; set firing_lastweapon cl_swapattacks_$1; firing_switch" \ No newline at end of file -- 2.39.2