]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Avoid changing timelimit in the endmatch alias so that the timer shows the correct...
authorterencehill <piuntn@gmail.com>
Mon, 28 Feb 2022 22:26:50 +0000 (23:26 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 28 Feb 2022 23:01:50 +0000 (00:01 +0100)
commands.cfg
qcsrc/server/intermission.qc
qcsrc/server/world.qc
qcsrc/server/world.qh

index a6162badf4037b12ecdc6a15bd90b55b8e3e44d2..e9dfc0e0232ff9b6a11ac3e36fe6fb81f324076d 100644 (file)
@@ -238,7 +238,8 @@ alias unlockteams          "qc_cmd_sv     unlockteams          ${* ?}" // Enable
 alias warp                 "qc_cmd_sv     warp                 ${* ?}" // Choose different level in campaign
 
 // other aliases for server commands
-alias endmatch "timelimit -1"
+set _endmatch 0 "if set to 1 ends the match immediately; use it instead of timelimit -1 (deprecated)"
+alias endmatch "_endmatch 1"
 alias bots "minplayers 4; minplayers_per_team 2"
 alias nobots "minplayers 0; minplayers_per_team 0"
 
index 81850d8df33ce041796423d6ed377c31e28241e8..98d2ef25b08febaa7805ba1f42e5f7327cb9c0af 100644 (file)
@@ -399,7 +399,7 @@ string GotoMap(string m)
        if(!MapInfo_CheckMap(m))
                return "The map you suggested does not support the current game mode.";
        cvar_set("nextmap", m);
-       cvar_set("timelimit", "-1");
+       cvar_set("_endmatch", "1");
        if(mapvote_initialized || alreadychangedlevel)
        {
                if(DoNextMapOverride(0))
index be272b1fc10d1af45773889d71833f54123da0a7..f7a281998ccddf418bf5799590f51229479e71a5 100644 (file)
@@ -1275,6 +1275,7 @@ only called if a time or frag limit has expired
 */
 void NextLevel()
 {
+       cvar_set("_endmatch", "0");
        game_stopped = true;
        intermission_running = true; // game over
 
@@ -1613,17 +1614,16 @@ void CheckRules_World()
                leadlimit = 0; // no leadlimit for now
        }
 
-       if(timelimit > 0)
-       {
-               timelimit += game_starttime;
-       }
-       else if (timelimit < 0)
+       if (autocvar__endmatch || timelimit < 0)
        {
                // endmatch
                NextLevel();
                return;
        }
 
+       if(timelimit > 0)
+               timelimit += game_starttime;
+
        float wantovertime;
        wantovertime = 0;
 
index b23ffc4d866106fe6af454100c1cf6e225524e22..bf2092bbc0b7e96705fa003897b8a46e16d45cb8 100644 (file)
@@ -3,6 +3,7 @@
 #include <common/weapons/_all.qh>
 
 bool autocvar__sv_init;
+bool autocvar__endmatch;
 bool autocvar_g_use_ammunition;
 bool autocvar_g_jetpack;
 bool autocvar_g_warmup_allguns;