]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_client.qc
route selectteam through the kill delay system
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index 0de9785d3a45332d6676ccf7f3a7d8e61dadb3b7..1d034a4ec1a480a77a1bf16637a3ec8fba5b379d 100644 (file)
@@ -1222,6 +1222,7 @@ Called when a client types 'kill' in the console
 =============
 */
 
+.float clientkill_nexttime;
 void ClientKill_Now_TeamChange()
 {
        if(self.killindicator_teamchange == -1)
@@ -1230,7 +1231,13 @@ void ClientKill_Now_TeamChange()
                JoinBestTeam( self, FALSE, FALSE );
        }
        else if(self.killindicator_teamchange == -2)
+       {
+               if(g_ca)
+                       self.caplayer = 0;
+               if(blockSpectators)
+                       sprint(self, strcat("^7You have to become a player within the next ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n"));
                PutObserverInServer();
+       }
        else
                SV_ChangeTeam(self.killindicator_teamchange - 1);
 }
@@ -1299,6 +1306,10 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
        if(g_race_qualifying)
                killtime = 0;
 
+       // flood control it
+       killtime = max(killtime, self.clientkill_nexttime - time);
+       self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
+
        self.killindicator_teamchange = targetteam;
 
        if(!self.killindicator)
@@ -1338,10 +1349,14 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
        }
        if(self.killindicator)
        {
-               if(targetteam)
-                       self.killindicator.colormod = TeamColor(targetteam);
-               else
+               if(targetteam == 0) // just die
                        self.killindicator.colormod = '0 0 0';
+               else if(targetteam == -1) // auto
+                       self.killindicator.colormod = '0 1 0';
+               else if(targetteam == -2) // spectate
+                       self.killindicator.colormod = '0.5 0.5 0.5';
+               else
+                       self.killindicator.colormod = TeamColor(targetteam);
        }
 }