From: drjaska Date: Mon, 27 May 2024 08:32:49 +0000 (+0300) Subject: Fix Morosophos' code X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bb13a00538c63fc19f0a59870d440a8e9591465c;p=xonotic%2Fxonotic-data.pk3dir.git Fix Morosophos' code source: https://gitlab.com/xonotic/xonotic-data.pk3dir/-/commit/f6a061a6b48a605ff5c11058b4b1cc2462c5f607 --- diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index a859acbded..1a8c632098 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -361,6 +361,7 @@ set g_cts 0 "CTS: complete the stage" set g_cts_selfdamage 1 "0 = disable all selfdamage and falldamage in cts" set g_cts_finish_kill_delay 2 "kill player this many seconds after stage completion to prevent cheating by starting out with more speed than otherwise possible; set it to 0 to not kill or to -1 to kill instantly" set g_cts_send_rankings_cnt 15 "send this number of map records to clients" +set g_cts_cptimes_onlyself 0 "tournament mode: only show player's own checkpoint times" set g_cts_removeprojectiles 0 "remove projectiles when the player dies, to prevent using weapons earlier in the stage than intended" set g_cts_drop_monster_items 0 "allow killed monsters to drop their items" diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 739eef06f0..e8202296d1 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -219,11 +219,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 (g_cts && autocvar_g_cts_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; @@ -518,12 +526,18 @@ void race_SendTime(entity e, float cp, float t, float tvalid) if(tvalid) { - recordtime = race_checkpoint_records[cp]; float myrecordtime = e.race_checkpoint_record[cp]; - recordholder = strcat(race_checkpoint_recordholders[cp]); // make a tempstring copy, as we'll possibly strunzone it! - if(recordholder == e.netname) + if (g_cts && autocvar_g_cts_cptimes_onlyself) { + recordtime = myrecordtime; 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) { if(cp == race_timed_checkpoint) diff --git a/qcsrc/server/race.qh b/qcsrc/server/race.qh index 1e851ee304..6eb6f9e51d 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_cts_cptimes_onlyself = false; int g_race_qualifying;