]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/teamplay.qc
Merge branch 'terencehill/connection_msg_fix' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / teamplay.qc
index 2f2bf545455a60af2b6a1c4185bd25ce43bda98f..1cd11b6854cc574277eed9b3a01014d274232267 100644 (file)
@@ -114,7 +114,7 @@ string GetClientVersionMessage()
        return versionmsg;
 }
 
-string getwelcomemessage(void)
+string getwelcomemessage()
 {
        string s, modifications, motd;
 
@@ -132,8 +132,6 @@ string getwelcomemessage(void)
                modifications = strcat(modifications, ", No start weapons");
        if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
                modifications = strcat(modifications, ", Low gravity");
-       if(g_cloaked && !g_cts)
-               modifications = strcat(modifications, ", Cloaked");
        if(g_weapon_stay && !g_cts)
                modifications = strcat(modifications, ", Weapons stay");
        if(g_jetpack)
@@ -153,9 +151,6 @@ string getwelcomemessage(void)
        if(modifications != "")
                s = strcat(s, "^8\nactive modifications: ^3", modifications, "^8\n");
 
-       if (cvar("g_nades"))
-               s = strcat(s, "\n\n^3nades^8 are enabled, press 'g' to use them\n");
-
        if(cache_lastmutatormsg != autocvar_g_mutatormsg)
        {
                if(cache_lastmutatormsg)
@@ -313,26 +308,24 @@ float PlayerValue(entity p)
 // teams that are allowed will now have their player counts stored in c1...c4
 void GetTeamCounts(entity ignore)
 {
-       entity head;
        float value, bvalue;
        // now count how many players are on each team already
 
        // FIXME: also find and memorize the lowest-scoring bot on each team (in case players must be shuffled around)
        // also remember the lowest-scoring player
 
-       FOR_EACH_CLIENT(head)
-       {
+       FOREACH_CLIENT(true, LAMBDA(
                float t;
-               if(IS_PLAYER(head) || head.caplayer)
-                       t = head.team;
-               else if(head.team_forced > 0)
-                       t = head.team_forced; // reserve the spot
+               if(IS_PLAYER(it) || it.caplayer)
+                       t = it.team;
+               else if(it.team_forced > 0)
+                       t = it.team_forced; // reserve the spot
                else
                        continue;
-               if(head != ignore)// && head.netname != "")
+               if(it != ignore)// && it.netname != "")
                {
-                       value = PlayerValue(head);
-                       if(IS_BOT_CLIENT(head))
+                       value = PlayerValue(it);
+                       if(IS_BOT_CLIENT(it))
                                bvalue = value;
                        else
                                bvalue = 0;
@@ -369,7 +362,7 @@ void GetTeamCounts(entity ignore)
                                }
                        }
                }
-       }
+       ));
 
        // if the player who has a forced team has not joined yet, reserve the spot
        if(autocvar_g_campaign)
@@ -588,11 +581,19 @@ void SV_ChangeTeam(float _color)
        float scolor, dcolor, steam, dteam; //, dbotcount, scount, dcount;
 
        // in normal deathmatch we can just apply the color and we're done
-       if(!teamplay) {
+       if(!teamplay)
                SetPlayerColors(self, _color);
+
+       if(!IS_CLIENT(self))
+       {
+               // since this is an engine function, and gamecode doesn't have any calls earlier than this, do the connecting message here
+               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_CONNECTING, self.netname);
                return;
        }
 
+       if(!teamplay)
+               return;
+
        scolor = self.clientcolors & 0x0F;
        dcolor = _color & 0x0F;
 
@@ -652,9 +653,7 @@ void SV_ChangeTeam(float _color)
                TeamchangeFrags(self);
        }
 
-       // since this is an engine function, and gamecode doesn't have any calls earlier than this, do the connecting message here
-       if(!IS_CLIENT(self))
-               Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_CONNECTING, self.netname);
+       MUTATOR_CALLHOOK(Player_ChangeTeam, self, steam, dteam);
 
        SetPlayerTeam(self, dteam, steam, !IS_CLIENT(self));