From e18f904d6ae687895cd990cabe979efb0dad8c1b Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Sun, 28 Jul 2019 03:54:43 +0200 Subject: [PATCH] explain cvar prefixes, rename name_maxlength --- qcsrc/server/autocvars.qh | 2 +- qcsrc/server/client.qc | 6 +++--- xonotic-common.cfg | 7 +++++++ xonotic-server.cfg | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index fd5009edc..332b12b9b 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -253,7 +253,6 @@ int autocvar_leadlimit_and_fraglimit; int autocvar_leadlimit_override; int autocvar_minplayers; int autocvar_minplayers_per_team; -int autocvar_name_maxlength; string autocvar_nextmap; string autocvar_quit_and_redirect; float autocvar_quit_and_redirect_timer; @@ -316,6 +315,7 @@ float autocvar_sv_mapchange_delay; float autocvar_sv_maxairspeed; float autocvar_sv_maxspeed; string autocvar_sv_motd; +int autocvar_sv_name_maxlength; bool autocvar_sv_precacheplayermodels; bool autocvar_sv_q3acompat_machineshotgunswap; bool autocvar_sv_servermodelsonly; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 0498bce52..39ea13604 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2392,11 +2392,11 @@ void PlayerPreThink (entity this) if (this.netname == "" || this.netname != CS(this).netname_previous) { bool assume_unchanged = (CS(this).netname_previous == ""); - if (autocvar_name_maxlength > 0 && strlennocol(this.netname) > autocvar_name_maxlength) + if (autocvar_sv_name_maxlength > 0 && strlennocol(this.netname) > autocvar_sv_name_maxlength) { - int new_length = textLengthUpToLength(this.netname, autocvar_name_maxlength, strlennocol); + int new_length = textLengthUpToLength(this.netname, autocvar_sv_name_maxlength, strlennocol); this.netname = strzone(strcat(substring(this.netname, 0, new_length), "^7")); - sprint(this, sprintf("Warning: your name is longer than %d characters, it has been truncated.\n", autocvar_name_maxlength)); + sprint(this, sprintf("Warning: your name is longer than %d characters, it has been truncated.\n", autocvar_sv_name_maxlength)); assume_unchanged = false; // stuffcmd(this, strcat("name ", this.netname, "\n")); // maybe? } diff --git a/xonotic-common.cfg b/xonotic-common.cfg index 3a01784c7..f44d9c96f 100644 --- a/xonotic-common.cfg +++ b/xonotic-common.cfg @@ -1,3 +1,10 @@ +// most common prefixes (currently not used consistently - especially g_ and sv_): +// cl_ client +// g_ gameplay +// r_ renderer +// sv_ server administration, should not affect gameplay +// _ temporary, private or internal cvar - should not be changed manually, sometimes used in scripts + // Xonotic version (formatted for machines) // used to determine if a client version is compatible // this doesn't have to be bumped with every release diff --git a/xonotic-server.cfg b/xonotic-server.cfg index dadc207b5..9613e7e77 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -2,7 +2,7 @@ // note that it doesn't reset all server cvars, // some are shared with the client and so are left in xonotic-common.cfg -set name_maxlength 64 "max player name length (not counting color codes) allowed by the server" +set sv_name_maxlength 64 "max player name length (not counting color codes) allowed by the server" // taunts and voices set sv_taunt 1 "allow taunts on the server" -- 2.39.2