]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
CA: newcomer players can only join the game during the countdown to round start;...
authorterencehill <piuntn@gmail.com>
Sat, 2 Mar 2013 11:51:18 +0000 (12:51 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 2 Mar 2013 11:51:18 +0000 (12:51 +0100)
qcsrc/server/mutators/gamemode_ca.qc
qcsrc/server/mutators/gamemode_ca.qh
qcsrc/server/round_handler.qc

index 291166fe7bf06c47cb662666386b7d5e4e85a2b0..0b47a2dd5284b8389a87dd5b0ca35acec4e82e5d 100644 (file)
@@ -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();
                }
        }
index 54df1a4013999347be22ee333d4f34dba4b19ef5..ab0a9d1954e928a5e4621df4fb34bb1b1ec5d3e8 100644 (file)
@@ -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
 
index 0883847815cf2cb348ea7265732d2e2bab7263d4..f30ea02fe2dda2a8d1b663c3f434f0f0a2f32aaa 100644 (file)
@@ -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