From d63637891188157d2bdc0260a3a10b24c6da61a7 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 2 Mar 2013 12:51:18 +0100 Subject: [PATCH] CA: newcomer players can only join the game during the countdown to round start; if they try to do it during a round or when the round is over they get scheduled to play the next round --- qcsrc/server/mutators/gamemode_ca.qc | 17 ++++++++++++----- qcsrc/server/mutators/gamemode_ca.qh | 2 +- qcsrc/server/round_handler.qc | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc index 291166fe7..0b47a2dd5 100644 --- a/qcsrc/server/mutators/gamemode_ca.qc +++ b/qcsrc/server/mutators/gamemode_ca.qc @@ -73,7 +73,7 @@ float CA_CheckWinner() FOR_EACH_REALCLIENT(e) centerprint(e, "Round over, there's no winner"); bprint("Round over, there's no winner.\n"); - allowed_to_spawn = TRUE; + allowed_to_spawn = FALSE; return 1; } @@ -99,7 +99,7 @@ float CA_CheckWinner() bprint("Round tied.\n"); } - allowed_to_spawn = TRUE; + allowed_to_spawn = FALSE; return 1; } @@ -147,16 +147,22 @@ float CA_CheckTeams() MUTATOR_HOOKFUNCTION(ca_PlayerSpawn) { - self.caplayer = TRUE; + self.caplayer = 1; return 1; } MUTATOR_HOOKFUNCTION(ca_PutClientInServer) { - if(clienttype(self) == CLIENTTYPE_BOT) - self.caplayer = TRUE; if(!allowed_to_spawn) + { self.classname = "observer"; + if(!self.caplayer) + { + self.caplayer = 0.5; + if(clienttype(self) == CLIENTTYPE_REAL) + sprint(self, "You will join the game in the next round.\n"); + } + } return 1; } @@ -167,6 +173,7 @@ MUTATOR_HOOKFUNCTION(ca_reset_map_players) if(self.caplayer) { self.classname = "player"; + self.caplayer = 1; PutClientInServer(); } } diff --git a/qcsrc/server/mutators/gamemode_ca.qh b/qcsrc/server/mutators/gamemode_ca.qh index 54df1a401..ab0a9d195 100644 --- a/qcsrc/server/mutators/gamemode_ca.qh +++ b/qcsrc/server/mutators/gamemode_ca.qh @@ -1,3 +1,3 @@ // should be removed in the future, as other code should not have to care -.float caplayer; +.float caplayer; // 0.5 if scheduled to join the next round diff --git a/qcsrc/server/round_handler.qc b/qcsrc/server/round_handler.qc index 088384781..f30ea02fe 100644 --- a/qcsrc/server/round_handler.qc +++ b/qcsrc/server/round_handler.qc @@ -17,10 +17,10 @@ void round_handler_Think() if(self.wait) { - reset_map(TRUE); self.wait = FALSE; self.cnt = self.count + 1; // init countdown round_starttime = time + self.count; + reset_map(TRUE); } if(self.cnt > 0) // countdown running -- 2.39.2