]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Assault: add a couple informational messages and fix various bugs related to the...
authorterencehill <piuntn@gmail.com>
Sun, 2 Jan 2022 16:23:31 +0000 (17:23 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 2 Jan 2022 16:23:31 +0000 (17:23 +0100)
qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc
qcsrc/server/command/vote.qc
qcsrc/server/command/vote.qh
qcsrc/server/round_handler.qc

index f5683051c4694151c9923d4e738cbacbacfd0006..5edfd5ff1863362ecaf53354431793598c11e228 100644 (file)
@@ -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));
index aefbc3fd1c502896cd6cfc41c4dc67053bdbe080..f8345bd83a8ebf783491420d544e50e39cf65272 100644 (file)
@@ -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
index 843d59618e9c43a6b77310e6e8ebe9b40fb101b6..63c9e8e453765892bff4823cc41de0e7865e1453 100644 (file)
@@ -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();
 
index 93c3835271a049b796eaab6a2ff4911ebfe7b6fd..5307eca782a827398f66eed801fdd73682d458b4 100644 (file)
@@ -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