From: terencehill <piuntn@gmail.com>
Date: Sat, 2 Mar 2013 11:51:18 +0000 (+0100)
Subject: CA: newcomer players can only join the game during the countdown to round start;... 
X-Git-Tag: xonotic-v0.7.0~61^2~37
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d63637891188157d2bdc0260a3a10b24c6da61a7;p=xonotic%2Fxonotic-data.pk3dir.git

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
---

diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc
index 291166fe7b..0b47a2dd52 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 54df1a4013..ab0a9d1954 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 0883847815..f30ea02fe2 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