From bc338fedcc64d36c0537ac194d63f84c69a95e36 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Thu, 23 Feb 2012 20:18:27 +0100 Subject: [PATCH] delay quit_and_redirect by a timer --- defaultXonotic.cfg | 3 ++- qcsrc/server/autocvars.qh | 1 + qcsrc/server/g_world.qc | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index d9db20f19..e4899175e 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1029,6 +1029,7 @@ set nextmap "" "override the maplist when switching to the next map" set lastlevel "" set quit_when_empty 0 "set to 1, then the server exits when the next level would start but is empty" set quit_and_redirect "" "set to an IP to redirect all players at the end of the match to another server. Set to \"self\" to let all players reconnect at the end of the match (use it to make seamless engine updates)" +set quit_and_redirect_timer 1.5 "set to number of seconds after quit before performing the connect operation of quit_and_redirect" // singleplayer campaign set g_campaign 0 @@ -1928,4 +1929,4 @@ if_dedicated set g_start_delay 15 "delay before the game starts, so everyone can alias menu_sync "menu_cmd sync" set sv_join_notices "" -set sv_join_notices_time 15 \ No newline at end of file +set sv_join_notices_time 15 diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index e336efc53..e32fa17f6 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -1052,6 +1052,7 @@ float autocvar_minplayers; string autocvar_nextmap; float autocvar_prvm_backtraceforwarnings; string autocvar_quit_and_redirect; +float autocvar_quit_and_redirect_timer; float autocvar_quit_when_empty; float autocvar_r_showbboxes; float autocvar_rescan_pending; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index bd49365a6..289f07fa7 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -2860,11 +2860,12 @@ float RedirectionThink() clients_found = 0; FOR_EACH_REALCLIENT(self) { + // TODO add timer print("Redirecting: sending connect command to ", self.netname, "\n"); if(redirection_target == "self") - stuffcmd(self, "\ndisconnect; reconnect\n"); + stuffcmd(self, "\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " reconnect\n"); else - stuffcmd(self, strcat("\ndisconnect; connect ", redirection_target, "\n")); + stuffcmd(self, strcat("\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " \"connect ", redirection_target, "\"\n")); ++clients_found; } -- 2.39.2