From 562fc9d1dc588a5411f6a409abde06bd56d37a00 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 2 Jan 2022 17:23:31 +0100 Subject: [PATCH] Assault: add a couple informational messages and fix various bugs related to the start of the second round --- .../gamemodes/gamemode/assault/sv_assault.qc | 7 +++--- qcsrc/server/command/vote.qc | 23 ++++++++++--------- qcsrc/server/command/vote.qh | 4 ++-- qcsrc/server/round_handler.qc | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc index f5683051c..5edfd5ff1 100644 --- a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc +++ b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc @@ -191,8 +191,6 @@ void assault_wall_think(entity this) // reset objectives, toggle spawnpoints, reset triggers, ... void assault_new_round(entity this) { - //bprint("ASSAULT: new round\n"); - // up round counter this.winning = this.winning + 1; @@ -212,7 +210,8 @@ void assault_new_round(entity this) // reset the level with a countdown cvar_set("timelimit", ftos(ceil(time - AS_ROUND_DELAY - game_starttime) / 60)); - ReadyRestart_force(); // sets game_starttime + bprint("Starting second round...\n"); + ReadyRestart_force(true); // sets game_starttime } entity as_round; @@ -251,7 +250,7 @@ int WinningCondition_Assault() { if(ent.winning) // round end has been triggered by attacking team { - bprint("Assault: round completed.\n"); + bprint(Team_ColoredFullName(assault_attacker_team), " destroyed the objective in ", process_time(2, ceil(time - game_starttime)), "\n"); SetWinners(team, assault_attacker_team); TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 666 - TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 0)); diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index aefbc3fd1..f8345bd83 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -336,14 +336,15 @@ void VoteThink() // ======================= // Resets the state of all clients, items, weapons, waypoints, ... of the map. -void reset_map(bool dorespawn) +void reset_map(bool dorespawn, bool is_fake_round_start) { if (time <= game_starttime) { if (game_stopped) return; - PlayerStats_GameReport_Reset_All(); + if (!is_fake_round_start) + PlayerStats_GameReport_Reset_All(); if (round_handler_IsActive()) round_handler_Reset(game_starttime); } @@ -413,18 +414,18 @@ void reset_map(bool dorespawn) // Restarts the map after the countdown is over (and cvar sv_ready_restart_after_countdown is set) void ReadyRestart_think(entity this) { - reset_map(true); + reset_map(true, false); Score_ClearAll(); delete(this); } // Forces a restart of the game without actually reloading the map // this is a mess... -void ReadyRestart_force() +void ReadyRestart_force(bool is_fake_round_start) { if (time <= game_starttime && game_stopped) return; - - bprint("^1Match is restarting...\n"); + if (!is_fake_round_start) + bprint("^1Match is restarting...\n"); VoteReset(); @@ -432,7 +433,7 @@ void ReadyRestart_force() if (checkrules_overtimesadded > 0 && g_race_qualifying != 2) cvar_set("timelimit", ftos(autocvar_timelimit - (checkrules_overtimesadded * autocvar_timelimit_overtime))); checkrules_suddendeathend = checkrules_overtimesadded = checkrules_suddendeathwarning = 0; - + if(warmup_stage) game_starttime = time; // Warmup: No countdown in warmup else @@ -445,7 +446,7 @@ void ReadyRestart_force() }); // if we're ending the warmup stage call the corresponding hook - if(!warmup_stage) + if(!is_fake_round_start && !warmup_stage) localcmd("\nsv_hook_warmupend\n"); // reset the .ready status of all players (also spectators) @@ -458,7 +459,7 @@ void ReadyRestart_force() lockteams = !warmup_stage; // initiate the restart-countdown-announcer entity - if (sv_ready_restart_after_countdown && !warmup_stage) + if (!is_fake_round_start && sv_ready_restart_after_countdown && !warmup_stage) { entity restart_timer = new_pure(restart_timer); setthink(restart_timer, ReadyRestart_think); @@ -471,7 +472,7 @@ void ReadyRestart_force() FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), { CS(it).allowed_timeouts = autocvar_sv_timeout_number; }); } - if (!sv_ready_restart_after_countdown || warmup_stage) reset_map(true); + if (!sv_ready_restart_after_countdown || warmup_stage) reset_map(true, is_fake_round_start); if (autocvar_sv_eventlog) GameLogEcho(":restart"); } @@ -489,7 +490,7 @@ void ReadyRestart(bool forceWarmupEnd) else warmup_stage = cvar("g_warmup"); // go into warmup if it's enabled, otherwise restart into match stage - ReadyRestart_force(); + ReadyRestart_force(false); } // Count the players who are ready and determine whether or not to restart the match diff --git a/qcsrc/server/command/vote.qh b/qcsrc/server/command/vote.qh index 843d59618..63c9e8e45 100644 --- a/qcsrc/server/command/vote.qh +++ b/qcsrc/server/command/vote.qh @@ -67,9 +67,9 @@ float readycount; // amount of players who are ready .int team_saved; // team number to restore upon map reset .void(entity this) reset; // if set, an entity is reset using this .void(entity this) reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities) -void reset_map(float dorespawn); +void reset_map(float dorespawn, bool is_fake_round_start); void ReadyCount(); -void ReadyRestart_force(); +void ReadyRestart_force(bool is_fake_round_start); void VoteCount(float first_count); void Nagger_Init(); diff --git a/qcsrc/server/round_handler.qc b/qcsrc/server/round_handler.qc index 93c383527..5307eca78 100644 --- a/qcsrc/server/round_handler.qc +++ b/qcsrc/server/round_handler.qc @@ -28,7 +28,7 @@ void round_handler_Think(entity this) this.wait = false; this.cnt = this.count + 1; // init countdown round_starttime = time + this.count; - reset_map(true); + reset_map(true, false); } if (this.cnt > 0) // countdown running -- 2.39.2