From: Mario Date: Tue, 5 Apr 2016 15:47:03 +0000 (+1000) Subject: Add a cvar to allow overriding the default/player chosen skin X-Git-Tag: xonotic-v0.8.2~973 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=62f5b35dbc92b04ef04ccf465852b0b7947fc8a7;p=xonotic%2Fxonotic-data.pk3dir.git Add a cvar to allow overriding the default/player chosen skin --- diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 893bb6478..4a395574a 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -331,6 +331,7 @@ int autocvar_sv_clientcommand_antispam_count; bool autocvar_sv_curl_serverpackages_auto; bool autocvar_sv_db_saveasdump; bool autocvar_sv_defaultcharacter; +bool autocvar_sv_defaultcharacterskin; string autocvar_sv_defaultplayercolors; string autocvar_sv_defaultplayermodel; string autocvar_sv_defaultplayermodel_blue; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 45d8b5358..ffbb55087 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -371,6 +371,19 @@ void FixPlayermodel(entity player) defaultmodel = substring(defaultmodel, 0, i); } } + if(autocvar_sv_defaultcharacterskin && !defaultskin) + { + if(teamplay) + { + string s = Static_Team_ColorName_Lower(player.team); + if (s != "neutral") + defaultskin = cvar(strcat("sv_defaultplayerskin_", s)); + } + + if(!defaultskin) + defaultskin = autocvar_sv_defaultplayerskin; + } + MUTATOR_CALLHOOK(FixPlayermodel, defaultmodel, defaultskin); defaultmodel = ret_string; defaultskin = ret_int; @@ -401,8 +414,16 @@ void FixPlayermodel(entity player) chmdl = true; } - oldskin = player.skin; - player.skin = stof(player.playerskin); + if(!autocvar_sv_defaultcharacterskin) + { + oldskin = player.skin; + player.skin = stof(player.playerskin); + } + else + { + oldskin = player.skin; + player.skin = defaultskin; + } } if(chmdl || oldskin != player.skin) // model or skin has changed diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 5714393b7..054e19d74 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -413,6 +413,7 @@ void cvar_changes_init() BADCVAR("sv_autotaunt"); BADCVAR("sv_curl_defaulturl"); BADCVAR("sv_defaultcharacter"); + BADCVAR("sv_defaultcharacterskin"); BADCVAR("sv_defaultplayercolors"); BADCVAR("sv_defaultplayermodel"); BADCVAR("sv_defaultplayerskin");