From: Mario Date: Wed, 26 Sep 2018 00:30:44 +0000 (+1000) Subject: Add a temporary client-server option to allow turning off auto switching in CTS X-Git-Tag: xonotic-v0.8.5~1830 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=5d36c4af90925223244be05529c0152f5011e7ce Add a temporary client-server option to allow turning off auto switching in CTS --- diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 0d4d2b92ab..dfee5330df 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -856,7 +856,7 @@ float Item_GiveTo(entity item, entity player) return 0; // crude hack to enforce switching weapons - if(g_cts && item.itemdef.instanceOfWeaponPickup) + if(g_cts && item.itemdef.instanceOfWeaponPickup && !CS(player).cvar_cl_cts_noautoswitch) { for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 26388e7b37..80965de759 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -145,6 +145,7 @@ CLASS(Client, Object) ATTRIB(Client, cvar_cl_accuracy_data_receive, bool, this.cvar_cl_accuracy_data_receive); 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); METHOD(Client, m_unwind, bool(Client this)); diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 58111fb12b..8f4e903490 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -168,6 +168,7 @@ float default_weapon_alpha; .float cvar_cl_jetpack_jump; .float cvar_cl_movement_track_canjump; .float cvar_cl_newusekeysupported; +.float cvar_cl_cts_noautoswitch; .string cvar_g_xonoticversion; .string cvar_cl_weaponpriority; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index cf7266b483..47c0cb2fe4 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -416,6 +416,8 @@ REPLICATE(cvar_cl_weaponimpulsemode, int, "cl_weaponimpulsemode"); REPLICATE(cvar_g_xonoticversion, string, "g_xonoticversion"); +REPLICATE(cvar_cl_cts_noautoswitch, bool, "cl_cts_noautoswitch"); + /** * @param f -1: cleanup, 0: request, 1: receive */ diff --git a/xonotic-client.cfg b/xonotic-client.cfg index ed81e0fb55..51c66081fc 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -650,6 +650,8 @@ seta cl_jetpack_jump 1 "Activate jetpack by pressing jump in the air. 0 = Disabl seta cl_race_cptimes_showself 1 "Always show your own times as well as the current best on checkpoints in Race/CTS" seta cl_race_cptimes_onlyself 0 "Only show your own times on checkpoints in Race/CTS" +seta cl_cts_noautoswitch 0 "Prevent forced switching to new weapons in CTS" + set cl_stripcolorcodes 0 "experimental feature (notes: strips ALL color codes from messages!)" // Demo camera