From: Mario Date: Mon, 30 Mar 2020 15:24:47 +0000 (+1000) Subject: Add an option to use a server default for clients as a fallback and make use of it... X-Git-Tag: xonotic-v0.8.5~1139 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ad4392d97a6d036540ef8723583d4997c3970e9a;p=xonotic%2Fxonotic-data.pk3dir.git Add an option to use a server default for clients as a fallback and make use of it to allow optional multijump (multijump is enabled by default but configurable on the server) --- diff --git a/mutators.cfg b/mutators.cfg index fd69befbb..2d5289378 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -446,8 +446,9 @@ set g_breakablehook_owner 0 "allow owner to break their own hook" // =========== // multijump // =========== -seta cl_multijump 1 "allow multijump mutator" +seta cl_multijump -1 "allow multijump mutator, set to -1 for the server to decide whether it's enabled" set g_multijump 0 "Number of multiple jumps to allow (jumping again in the air), -1 allows for infinite jumps" +set g_multijump_client 1 "If the client sets cl_multijump to -1, this setting is used for them as a default" set g_multijump_add 0 "0 = make the current z velocity equal to jumpvelocity, 1 = add jumpvelocity to the current z velocity" set g_multijump_speed -999999 "Minimum vertical speed a player must have in order to jump again" set g_multijump_maxspeed 0 diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index b7b7e5303..72ee803fa 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -136,7 +136,7 @@ void CSQC_Init() registercvar("cl_shootfromfixedorigin", ""); - registercvar("cl_multijump", "1"); + registercvar("cl_multijump", "-1"); registercvar("cl_spawn_near_teammate", "1"); diff --git a/qcsrc/common/mutators/mutator/multijump/multijump.qc b/qcsrc/common/mutators/mutator/multijump/multijump.qc index 0efd85635..40bc9a33e 100644 --- a/qcsrc/common/mutators/mutator/multijump/multijump.qc +++ b/qcsrc/common/mutators/mutator/multijump/multijump.qc @@ -20,16 +20,17 @@ REGISTER_MUTATOR(multijump, true); #define PHYS_MULTIJUMP_MAXSPEED(s) STAT(MULTIJUMP_MAXSPEED, s) #define PHYS_MULTIJUMP_DODGING(s) STAT(MULTIJUMP_DODGING, s) #define PHYS_MULTIJUMP_COUNT(s) STAT(MULTIJUMP_COUNT, s) +#define PHYS_MULTIJUMP_CLIENTDEFAULT(s) STAT(MULTIJUMP_CLIENT, s) .bool multijump_ready; #ifdef CSQC -bool cvar_cl_multijump; -bool autocvar_cl_multijump = true; +int cvar_cl_multijump; +int autocvar_cl_multijump = -1; #define PHYS_MULTIJUMP_CLIENT(s) autocvar_cl_multijump #elif defined(SVQC) -.bool cvar_cl_multijump; +.int cvar_cl_multijump; #define PHYS_MULTIJUMP_CLIENT(s) CS(s).cvar_cl_multijump #endif @@ -54,6 +55,8 @@ MUTATOR_HOOKFUNCTION(multijump, PlayerJump) if(!PHYS_MULTIJUMP(player)) { return; } int client_multijump = PHYS_MULTIJUMP_CLIENT(player); + if(client_multijump == -1) + client_multijump = PHYS_MULTIJUMP_CLIENTDEFAULT(player); if(client_multijump > 1) return; // nope @@ -115,7 +118,7 @@ MUTATOR_HOOKFUNCTION(multijump, PlayerJump) } } -REPLICATE(cvar_cl_multijump, bool, "cl_multijump"); +REPLICATE(cvar_cl_multijump, int, "cl_multijump"); #ifdef SVQC diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index a13d5fcf6..14eafaf25 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -144,11 +144,13 @@ float autocvar_g_multijump_add; float autocvar_g_multijump_speed; float autocvar_g_multijump_maxspeed; float autocvar_g_multijump_dodging = 1; +bool autocvar_g_multijump_client = true; #endif REGISTER_STAT(MULTIJUMP_DODGING, int, autocvar_g_multijump_dodging) REGISTER_STAT(MULTIJUMP_MAXSPEED, float, autocvar_g_multijump_maxspeed) REGISTER_STAT(MULTIJUMP_ADD, int, autocvar_g_multijump_add) REGISTER_STAT(MULTIJUMP_SPEED, float, autocvar_g_multijump_speed) +REGISTER_STAT(MULTIJUMP_CLIENT, bool, autocvar_g_multijump_client) .int multijump_count; REGISTER_STAT(MULTIJUMP_COUNT, int, this.multijump_count) REGISTER_STAT(MULTIJUMP, int, autocvar_g_multijump)