From: terencehill Date: Sat, 23 Mar 2019 14:03:52 +0000 (+0100) Subject: Clan Arena and Freeze Tag: delay shuffleteams execution to the next round if called... X-Git-Tag: xonotic-v0.8.5~1404^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f1ca124dd302ff19f7d18cbc0fe8f97febd94602;p=xonotic%2Fxonotic-data.pk3dir.git Clan Arena and Freeze Tag: delay shuffleteams execution to the next round if called during a round --- diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc index 56cfabc50..487558837 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc @@ -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; +} diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc index c42c7443b..d38becd73 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc @@ -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; diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index d25d963fa..5ff2d3472 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -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; } diff --git a/qcsrc/server/command/sv_cmd.qh b/qcsrc/server/command/sv_cmd.qh index 00e216c92..d9eb04395 100644 --- a/qcsrc/server/command/sv_cmd.qh +++ b/qcsrc/server/command/sv_cmd.qh @@ -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); diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 51cf55ce3..d79c2418d 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -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,