]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a server-sided switch which replicates cl_race_cptimes_onlyself
authorDr. Jaska <drjaska83@gmail.com>
Tue, 2 Jul 2024 04:40:25 +0000 (04:40 +0000)
committerDr. Jaska <drjaska83@gmail.com>
Tue, 2 Jul 2024 04:40:25 +0000 (04:40 +0000)
gamemodes-server.cfg
qcsrc/server/race.qc
qcsrc/server/race.qh
xonotic-client.cfg

index bef7f6292fb3b5b419c6ff0683b17aeae8ee95c4..f3b6a95bbd2faeee87602893468abeb56f075305 100644 (file)
@@ -594,6 +594,7 @@ set g_race 0 "Race: be faster than your opponents"
 set g_race_qualifying_timelimit 0
 set g_race_qualifying_timelimit_override -1 "qualifying session time limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
 set g_race_teams 0     "when 2, 3, or 4, the race is played as a team game (the team members can add up their laps)"
+set g_race_cptimes_onlyself 0 "only show player's own checkpoint times"
 
 // ==========
 //  invasion
index 746fda0deb8a04183f0d71c5f917e8119ecafe34..a799bff1d4eb79884ba9e8d66a93eb4f89b766b5 100644 (file)
@@ -212,11 +212,19 @@ void race_SendNextCheckpoint(entity e, float spec) // qualifying only
                return;
 
        int cp = e.race_checkpoint;
-       float recordtime = race_checkpoint_records[cp];
+       float recordtime;
        float myrecordtime = e.race_checkpoint_record[cp];
-       string recordholder = race_checkpoint_recordholders[cp];
-       if(recordholder == e.netname)
+       string recordholder;
+       if (autocvar_g_race_cptimes_onlyself) {
+               recordtime = myrecordtime;
                recordholder = "";
+       } else {
+               recordtime = race_checkpoint_records[cp];
+               recordholder = race_checkpoint_recordholders[cp];
+
+               if(recordholder == e.netname)
+                       recordholder = "";
+       }
 
        if(!IS_REAL_CLIENT(e))
                return;
@@ -511,10 +519,21 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
 
                if(tvalid)
                {
-                       recordtime = race_checkpoint_records[cp];
-                       recordholder = strcat(race_checkpoint_recordholders[cp]); // make a tempstring copy, as we'll possibly strunzone it!
-                       if(recordholder == e.netname)
+                       if (autocvar_g_race_cptimes_onlyself)
+                       {
+                               // return their own checkpoint time
+                               recordtime = e.race_checkpoint_record[cp];
                                recordholder = "";
+                       }
+                       else
+                       {
+                               recordtime = race_checkpoint_records[cp];
+                               // make a tempstring copy, as we'll possibly strunzone it
+                               recordholder = strcat(race_checkpoint_recordholders[cp]);
+
+                               if(recordholder == e.netname)
+                                       recordholder = "";
+                       }
 
                        if(t != 0)
                        {
index b335f527765c32f00ec924aeb9412850945e6ec7..e408e82097c82463e908d024f364e56af25a302b 100644 (file)
@@ -8,6 +8,7 @@ float race_teams;
 const float ST_RACE_LAPS = 1;
 
 int autocvar_g_cts_send_rankings_cnt = 15;
+bool autocvar_g_race_cptimes_onlyself = false;
 
 int g_race_qualifying;
 
index 3d24428b30b8fcc352e5beaf193b45c0d75f2c67..4abe50fa3738adc6fecbd73aa2f497ca283b98f2 100644 (file)
@@ -710,7 +710,7 @@ alias cl_autoscreenshot_screenshot "alias cl_autoscreenshot_screenshot_s ""; tog
 seta cl_jetpack_jump 1 "Activate jetpack by pressing jump in the air. 0 = Disable, 1 = Stop when touching ground, 2 = Enable"
 
 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_race_cptimes_onlyself 0 "Only show your own times on checkpoints in Race/CTS. Can be forced on by the server via g_race_cptimes_onlyself"
 
 seta cl_cts_noautoswitch 0 "Prevent forced switching to new weapons in CTS"