]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix Morosophos' code
authordrjaska <drjaska83@gmail.com>
Mon, 27 May 2024 08:32:49 +0000 (11:32 +0300)
committerdrjaska <drjaska83@gmail.com>
Mon, 27 May 2024 08:32:49 +0000 (11:32 +0300)
source: https://gitlab.com/xonotic/xonotic-data.pk3dir/-/commit/f6a061a6b48a605ff5c11058b4b1cc2462c5f607

gamemodes-server.cfg
qcsrc/server/race.qc
qcsrc/server/race.qh

index a859acbded174ebaf334b8725ea30439b342c45a..1a8c632098d71b5beef7c1a2110f74d16f3dc4a8 100644 (file)
@@ -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"
 
index 739eef06f0ef80ebf0540cecca52e2f764fb272f..e8202296d1ad4a0dceff1c104213d3f8940145ab 100644 (file)
@@ -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)
index 1e851ee3041e7fd671397c917571292b5a5ef863..6eb6f9e51d3192d4b1b58719a3df8f0b742ba123 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_cts_cptimes_onlyself = false;
 
 int g_race_qualifying;