]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
change default cvar values to actual values from testing values and a few bugfixes
authordrjaska <drjaska83@gmail.com>
Thu, 12 May 2022 17:51:28 +0000 (20:51 +0300)
committerdrjaska <drjaska83@gmail.com>
Thu, 12 May 2022 17:51:28 +0000 (20:51 +0300)
properly handle checkpoint reset after warmup and dying
fix someone getting eliminated straight away after warmup ends

gamemodes-server.cfg
qcsrc/common/gamemodes/gamemode/ctscup/sv_ctscup.qc

index 32171efda49dba21de44c1f55381397cfa03ece3..e0268ab70cd9a67f1bac1a3177cb33f51fc14a2b 100644 (file)
@@ -340,9 +340,9 @@ set g_cts_removeprojectiles 0 "remove projectiles when the player dies, to preve
 // ========================
 set g_ctscup 0 "CTSCup: complete the stage, tournament edition"
 set g_ctscup_minplayers 3 "how many players are required to start a tournament"
-set g_ctscup_warmup 10 "time players get to run around and learn the map before the tournament starts"
-set g_ctscup_finishwait 10 "after first finish wait this time before disqualifying players who haven't finished
-set g_ctscup_maxroundlength 60 "max time for each round. adjust for map length. used to protect against multiple trolls holding spectators hostage forever if spectators can not vote"
+set g_ctscup_warmup 90 "time players get to run around and learn the map before the tournament starts"
+set g_ctscup_finishwait 20 "after first finish wait this time before disqualifying players who haven't finished"
+set g_ctscup_maxroundlength 120 "max time for each round. adjust for map length. used to protect against multiple trolls holding spectators hostage forever if spectators can not vote"
 
 // ==========================
 //  deathmatch (ffa or team)
index dde31189c2455848c5e2e5cae2e16c5dd16fab78..833ca6548697aa993e2de4badd8b7c2368b6618d 100644 (file)
@@ -249,7 +249,7 @@ MUTATOR_HOOKFUNCTION(ctscup, ForbidPlayerScore_Clear)
 
 
 
-int roundCounter; // unused?
+int roundCounter; // how many rounds have there been
 int roundPlayers; // amount of players currently in the game, does not include spectators
 int nextRoundPlayers; // how many players should participate in the next round
 bool tournamentStarted; // has the warmup ended
@@ -337,6 +337,11 @@ MUTATOR_HOOKFUNCTION(ctscup, PlayerSpawn)
                        SaveSaveState(player);
                }
        }
+       else
+       {
+               race_PreparePlayer(player);
+               SaveSaveState(player);
+       }
 }
 
 // a player is made a spectator
@@ -383,7 +388,7 @@ MUTATOR_HOOKFUNCTION(ctscup, Race_FinalCheckpoint)
                if (roundFirstFinisherTime == 0)
                        roundFirstFinisherTime = time;
        }
-       
+
        // softlock player's race checkpoint progress
        // until next round, prevents 2nd laps and
        // registering the better time out of those 2
@@ -410,7 +415,8 @@ MUTATOR_HOOKFUNCTION(ctscup, Damage_Calculate)
        }
 
        // if the player were to be about to die, try to save them and restore a loadstate if possible
-       else if (((GetResource(frag_target, RES_HEALTH) + GetResource(frag_target, RES_ARMOR)) - frag_damage) <= 0)
+       else if (tournamentStarted &&
+               (((GetResource(frag_target, RES_HEALTH) + GetResource(frag_target, RES_ARMOR)) - frag_damage) <= 0))
                        if (LoadSaveState(frag_target))
                        {
                                // if savestate loading was successful
@@ -539,6 +545,7 @@ bool CTSCUP_CheckRoundEnd()
                        PrintToChatAll(" \n");
                        PrintToChatAll("^3Not enough players!  W A R M U P  restarted! \n");
                        PrintToChatAll(" \n");
+                       roundCounter = -1;
                        game_stopped = true;
                        round_handler_Init(0, 0.5, autocvar_g_ctscup_warmup);
                        return true;
@@ -585,7 +592,7 @@ bool CTSCUP_CheckRoundEnd()
                                PrintToChatAll(" \n");
                                PrintToChatAll("^3Everyone has a clear time! Ending warmup and starting the tournament! \n");
                                //PrintToChatAll(" \n");
-                               CTSCUP_TournamentStart();
+                               roundCounter = -1;
                                game_stopped = true;
                                round_handler_Init(5, 1, autocvar_g_ctscup_maxroundlength);
                                return true;
@@ -794,6 +801,7 @@ MUTATOR_HOOKFUNCTION(ctscup, reset_map_players)
        {
                CTSCUP_TournamentStart();
                roundCounter++;
+               Score_ClearAll();
        }
 
        // respawn players
@@ -845,8 +853,9 @@ MUTATOR_HOOKFUNCTION(ctscup, Race_Checkpoint)
 {
        entity player = M_ARGV(0, entity);
 
-       // mark round as started
-       roundStarted = true;
+       // mark round as started if we're in a tournament
+       if (tournamentStarted)
+               roundStarted = true;
 
                        // do not register savestates with corpses that hit checkpoints
        if (tournamentStarted && (GetResource(player, RES_HEALTH) >= 1))