]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/gamemodes/gamemode/race/sv_race.qc
Record player race move time in PlayerPreThink so it can be recorded while inside...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / race / sv_race.qc
index a69a435227785f7172f65558155049abaddbbc4e..c87384c94bc3377c45f27fa6d7ac422585c6657f 100644 (file)
@@ -128,16 +128,26 @@ MUTATOR_HOOKFUNCTION(rc, AbortSpeedrun)
                race_PreparePlayer(player); // nice try
 }
 
-MUTATOR_HOOKFUNCTION(rc, PlayerPhysics)
+MUTATOR_HOOKFUNCTION(rc, PlayerPreThink)
 {
        entity player = M_ARGV(0, entity);
-       float dt = M_ARGV(1, float);
 
+       if(!IS_PLAYER(player))
+               return;
+
+       // we need to perform this in PlayerPreThink as PlayerPhysics may not be called (vehicle support)
+       float dt = frametime;
        player.race_movetime_frac += dt;
        float f = floor(player.race_movetime_frac);
        player.race_movetime_frac -= f;
        player.race_movetime_count += f;
        player.race_movetime = player.race_movetime_frac + player.race_movetime_count;
+}
+
+MUTATOR_HOOKFUNCTION(rc, PlayerPhysics)
+{
+       entity player = M_ARGV(0, entity);
+       //float dt = M_ARGV(1, float);
 
 #ifdef SVQC
        if(IS_PLAYER(player))