]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix battle royale start being delayed by one frame
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 22 May 2023 06:24:30 +0000 (08:24 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 22 May 2023 07:01:50 +0000 (09:01 +0200)
qcsrc/common/gamemodes/gamemode/br/sv_br.qc

index 71f7f9b857470c091d6c3c0c68fe168befd3adab..a4b211a3d7f9662ec4d214ee4347868b9309c631 100644 (file)
@@ -1005,6 +1005,12 @@ MUTATOR_HOOKFUNCTION(br, ClientCommand_Spectate)
     return MUT_SPECCMD_CONTINUE;
 }
 
+MUTATOR_HOOKFUNCTION(br, PlayerSpawn)
+{
+    if(!br_started && !warmup_stage && (time > game_starttime) && br_CheckPlayers())
+        br_Start();
+}
+
 float br_CalculatePlayerDropAngle(entity this)
 {
     if(this.velocity.z < 0)
@@ -1137,6 +1143,8 @@ bool br_CheckPlayers()
 }
 
 void br_Start(){
+    br_started = true;
+
     // battle royale does not need those, besides, the timelimit won't be visible anymore after the game started
     cvar_set("timelimit", "0");
     cvar_set("fraglimit", "0");
@@ -1150,8 +1158,6 @@ void br_Start(){
 
     if(!dropship)
     {
-        br_started = true;
-
         delete(ring);
         ring = NULL;
 
@@ -1246,7 +1252,6 @@ void br_Start(){
     });
 
     round_handler.cnt = 0; // emulate round handler round start
-    br_started = true;
 }
 
 void br_dummy_Think(entity this){}