]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add cl_hook_race_pb to run on client when they set a new personal best time
authorDes - <gitlab@damianv.com.ar>
Sun, 1 Sep 2024 11:07:16 +0000 (11:07 +0000)
committerterencehill <piuntn@gmail.com>
Sun, 1 Sep 2024 11:07:16 +0000 (11:07 +0000)
gamemodes-client.cfg
qcsrc/common/gamemodes/gamemode/race/cl_race.qc

index c63bba5a76efb86a6ca15ae8ba4405dd4598828d..1648daca5b0fb83440b780b57b17dc1f332979c5 100644 (file)
@@ -39,3 +39,9 @@ alias cl_hook_gamestart_surv
 alias cl_hook_gameend
 alias cl_hook_shutdown
 alias cl_hook_activeweapon
+// called on client personal best set
+// $1 new pb time,
+// $2 old pb time,
+// $3 how much time the pb improved by
+// $4 new rank# on the leaderboard
+alias cl_hook_race_pb
index d0c3c03724d865f1a991858f435f1bb85de4b14e..f02905d60c97c6ba2e6e022b48a6aa60be46b610 100644 (file)
@@ -68,6 +68,11 @@ void HUD_Mod_Race(vector pos, vector mySize)
                        f &= ~1;
                        cvar_set("cl_autodemo_delete", ftos(f)); // don't delete demo with new record!
                }
+               localcmd("\ncl_hook_race_pb \"",
+                       TIME_ENCODED_TOSTRING(score, false), "\" \"",
+                       TIME_ENCODED_TOSTRING(t, false), "\" \"",
+                       (t ?  TIME_ENCODED_TOSTRING(t-score, false) : "0"), "\" \"",
+                       sprintf("%d", race_myrank), "\"\n");
        }
 
        if(t != crecordtime_prev) {