From: Dr. Jaska Date: Tue, 2 Jul 2024 04:40:25 +0000 (+0000) Subject: Add a server-sided switch which replicates cl_race_cptimes_onlyself X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8e8721062a81b0d4b202ebb739ee9c9c0e1e1864;p=xonotic%2Fxonotic-data.pk3dir.git Add a server-sided switch which replicates cl_race_cptimes_onlyself --- diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index bef7f6292..f3b6a95bb 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -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 diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 746fda0de..a799bff1d 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -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) { diff --git a/qcsrc/server/race.qh b/qcsrc/server/race.qh index b335f5277..e408e8209 100644 --- a/qcsrc/server/race.qh +++ b/qcsrc/server/race.qh @@ -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; diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 3d24428b3..4abe50fa3 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -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"