]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clan Arena and Freeze Tag: delay shuffleteams execution to the next round if called...
authorterencehill <piuntn@gmail.com>
Sat, 23 Mar 2019 14:03:52 +0000 (15:03 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 23 Mar 2019 14:03:52 +0000 (15:03 +0100)
qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/sv_cmd.qh
qcsrc/server/command/vote.qc

index 56cfabc501c151789bfd138556ab8c8f1a25976b..48755883726e4ee4a09acb64c719bbd99ba2bf9e 100644 (file)
@@ -505,3 +505,9 @@ MUTATOR_HOOKFUNCTION(ca, SetWeaponArena)
        // most weapons arena
        if (M_ARGV(0, string) == "0" || M_ARGV(0, string) == "") M_ARGV(0, string) = "most";
 }
+
+MUTATOR_HOOKFUNCTION(ca, SV_ParseServerCommand)
+{
+       shuffleteams_on_reset_map = !allowed_to_spawn;
+       return false;
+}
index c42c7443ba252a997d778f9c731132a292bc3857..d38becd7373e3cb77f6288deb11751a4bee14014 100644 (file)
@@ -608,6 +608,12 @@ MUTATOR_HOOKFUNCTION(ft, FragCenterMessage)
        return true;
 }
 
+MUTATOR_HOOKFUNCTION(ft, SV_ParseServerCommand)
+{
+       shuffleteams_on_reset_map = !(round_handler_IsActive() && !round_handler_IsRoundStarted());
+       return false;
+}
+
 void freezetag_Initialize()
 {
        freezetag_teams = autocvar_g_freezetag_teams_override;
index d25d963facc979e977d11dbed0b1e6aa2bbfa9c8..5ff2d3472ae22ebbf2d3d898e0ecbd5f4ae4c910 100644 (file)
@@ -1322,7 +1322,13 @@ void GameCommand_shuffleteams(int request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       shuffleteams();
+                       if (shuffleteams_on_reset_map)
+                       {
+                               bprint("Players will be shuffled when this round is over.\n");
+                               shuffleteams_on_reset_map = true;
+                       }
+                       else
+                               shuffleteams();
                        return;
                }
 
index 00e216c921855757b9a5aa87c23cfe5362fdbf9b..d9eb043957abd70a4c331a776c2a3dc8a8ee797a 100644 (file)
@@ -4,6 +4,7 @@
 //  Declarations for server side game commands
 // =================================================
 
+bool shuffleteams_on_reset_map;
 string GotoMap(string m);
 
 void race_deleteTime(string map, float pos);
index 51cf55ce3a1de3ee3c83cc027348ae803f7e072e..d79c2418d7adec421473ee7534ea01b9fe553c8c 100644 (file)
@@ -345,6 +345,11 @@ void reset_map(bool dorespawn)
                        round_handler_Reset(game_starttime);
        }
 
+       if (shuffleteams_on_reset_map)
+       {
+               shuffleteams();
+               shuffleteams_on_reset_map = false;
+       }
        MUTATOR_CALLHOOK(reset_map_global);
 
        FOREACH_ENTITY_FLOAT_ORDERED(pure_data, false,