]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a cvar to allow overriding the default/player chosen skin
authorMario <mario@smbclan.net>
Tue, 5 Apr 2016 15:47:03 +0000 (01:47 +1000)
committerMario <mario@smbclan.net>
Tue, 5 Apr 2016 15:48:45 +0000 (01:48 +1000)
qcsrc/server/autocvars.qh
qcsrc/server/cl_client.qc
qcsrc/server/g_world.qc

index 893bb647859e8da75b80b26b05e028c59e1ab530..4a395574aa515e257cae3d950305c99a085641b6 100644 (file)
@@ -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;
index 45d8b53582ec0df2d7ec7406240a464a14a6e7de..ffbb55087bef4ac48a98e36c8d9402fc9c7eb64c 100644 (file)
@@ -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
index 5714393b73217214796202d0b05c28d61684d59c..054e19d7466589c9ae0b3146843b9329d21157b9 100644 (file)
@@ -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");