From 14c06e0fcbb0a0c9660ec781f458e2d7afb7c81a Mon Sep 17 00:00:00 2001 From: drjaska Date: Thu, 12 May 2022 20:51:28 +0300 Subject: [PATCH] change default cvar values to actual values from testing values and a few bugfixes properly handle checkpoint reset after warmup and dying fix someone getting eliminated straight away after warmup ends --- gamemodes-server.cfg | 6 +++--- .../gamemodes/gamemode/ctscup/sv_ctscup.qc | 21 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/gamemodes-server.cfg b/gamemodes-server.cfg index 32171efda..e0268ab70 100644 --- a/gamemodes-server.cfg +++ b/gamemodes-server.cfg @@ -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) diff --git a/qcsrc/common/gamemodes/gamemode/ctscup/sv_ctscup.qc b/qcsrc/common/gamemodes/gamemode/ctscup/sv_ctscup.qc index dde31189c..833ca6548 100644 --- a/qcsrc/common/gamemodes/gamemode/ctscup/sv_ctscup.qc +++ b/qcsrc/common/gamemodes/gamemode/ctscup/sv_ctscup.qc @@ -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)) -- 2.39.2