]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_client.qc
Merge branch 'master' into terencehill/centerprint_stuff
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index 329a0f9b822f2ae342491351abcc238fd2c53217..e95c9499b7f0598a3882d479939124359bdcae9d 100644 (file)
@@ -333,7 +333,7 @@ entity SelectSpawnPoint (float anypoint)
                {
                        // we request a spawn for a team, and we have team
                        // spawns, but that team has no spawns?
-                       if(have_team_spawns[0])
+                       if(have_team_spawns_forteam[0])
                                // try noteam spawns
                                teamcheck = 0;
                        else
@@ -343,7 +343,7 @@ entity SelectSpawnPoint (float anypoint)
                else
                        teamcheck = self.team; // MUST be team
        }
-       else if(have_team_spawns == 0 && have_team_spawns[0])
+       else if(have_team_spawns == 0 && have_team_spawns_forteam[0])
                teamcheck = 0; // MUST be noteam
        else
                teamcheck = -1;
@@ -1134,7 +1134,7 @@ float ClientInit_SendEntity(entity to, float sf)
        WriteCoord(MSG_ENTITY, self.ebouncefactor); // g_balance_grenadelauncher_bouncefactor
        WriteCoord(MSG_ENTITY, self.ebouncestop); // g_balance_grenadelauncher_bouncestop
        WriteByte(MSG_ENTITY, autocvar_g_balance_nex_secondary); // client has to know if it should zoom or not
-       WriteByte(MSG_ENTITY, autocvar_g_balance_sniperrifle_secondary); // client has to know if it should zoom or not
+       WriteByte(MSG_ENTITY, autocvar_g_balance_rifle_secondary); // client has to know if it should zoom or not
        WriteByte(MSG_ENTITY, serverflags); // client has to know if it should zoom or not
        WriteByte(MSG_ENTITY, autocvar_g_balance_minelayer_limit); // minelayer max mines
        WriteByte(MSG_ENTITY, autocvar_g_balance_hagar_secondary_load_max); // hagar max loadable rockets
@@ -1302,14 +1302,14 @@ void KillIndicator_Think()
                        if(self.owner.killindicator_teamchange)
                        {
                                if(self.owner.killindicator_teamchange == -1)
-                                       centerprint(self.owner, strcat("Changing team in ", ftos(self.cnt), " seconds"));
+                                       centerprint(self.owner, strcat(CPID_TEAMCHANGE, "Changing team in ", ftos(self.cnt), " seconds"));
                                else if(self.owner.killindicator_teamchange == -2)
-                                       centerprint(self.owner, strcat("Spectating in ", ftos(self.cnt), " seconds"));
+                                       centerprint(self.owner, strcat(CPID_TEAMCHANGE, "Spectating in ", ftos(self.cnt), " seconds"));
                                else
-                                       centerprint(self.owner, strcat("Changing to ", ColoredTeamName(self.owner.killindicator_teamchange), " in ", ftos(self.cnt), " seconds"));
+                                       centerprint(self.owner, strcat(CPID_TEAMCHANGE, "Changing to ", ColoredTeamName(self.owner.killindicator_teamchange), " in ", ftos(self.cnt), " seconds"));
                        }
                        else
-                               centerprint(self.owner, strcat("^1Suicide in ", ftos(self.cnt), " seconds"));
+                               centerprint(self.owner, strcat(CPID_KILL, "^1Suicide in ", ftos(self.cnt), " seconds"));
                }
                self.nextthink = time + 1;
                self.cnt -= 1;
@@ -1639,6 +1639,9 @@ void ClientConnect (void)
 
        self.playerid = (playerid_last = playerid_last + 1);
 
+    if(clienttype(self) == CLIENTTYPE_BOT)
+        PlayerStats_AddPlayer(self);
+
        if(autocvar_sv_eventlog)
                GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((clienttype(self) == CLIENTTYPE_REAL) ? self.netaddress : "bot"), ":", self.netname));
 
@@ -1701,8 +1704,7 @@ void ClientConnect (void)
                ctf_clientconnect();
        }*/
 
-       if(teams_matter || radar_showennemies)
-               attach_entcs();
+       attach_entcs();
 
        bot_relinkplayerlist();
 
@@ -1771,15 +1773,6 @@ void ClientConnect (void)
                set_dom_state(self);
 
        CheatInitClient();
-
-       PlayerStats_AddPlayer(self);
-
-    self.shownames = spawn();
-    self.shownames.owner = self;
-    self.shownames.think = shownames_think;
-    self.shownames.nextthink = time;
-    self.shownames.customizeentityforclient = shownames_customize;
-    Net_LinkEntity(self.shownames, FALSE, 0, SendEntity_ShowNames);
 }
 
 /*
@@ -1790,7 +1783,6 @@ Called when a client disconnects from the server
 =============
 */
 .entity chatbubbleentity;
-.entity teambubbleentity;
 void ReadyCount();
 void ClientDisconnect (void)
 {
@@ -1844,9 +1836,6 @@ void ClientDisconnect (void)
        if (self.chatbubbleentity)
                remove (self.chatbubbleentity);
 
-       if (self.teambubbleentity)
-               remove (self.teambubbleentity);
-
        if (self.killindicator)
                remove (self.killindicator);
 
@@ -1879,8 +1868,6 @@ void ClientDisconnect (void)
        self.playerid = 0;
        ReadyCount();
 
-    remove(self.shownames);
-
        // free cvars
        GetCvars(-1);
 }
@@ -1929,52 +1916,6 @@ void UpdateChatBubble()
 }
 
 
-void TeamBubbleThink()
-{
-       self.nextthink = time;
-       if (!self.owner.modelindex || self.owner.teambubbleentity != self)
-       {
-               if(self.owner) // but why can that ever be world?
-                       self.owner.teambubbleentity = world;
-               remove(self);
-               return;
-       }
-//     setorigin(self, self.owner.origin + '0 0 15' + self.owner.maxs_z * '0 0 1');  // bandwidth hog. setattachment does this now
-       if (self.owner.BUTTON_CHAT || self.owner.deadflag || self.owner.killindicator)
-               self.model = "";
-       else
-               self.model = self.mdl;
-
-};
-
-float TeamBubble_customizeentityforclient()
-{
-       return (self.owner != other && self.owner.team == other.team && other.killcount > -666);
-}
-
-void UpdateTeamBubble()
-{
-       if (!self.modelindex || !teams_matter)
-               return;
-       // spawn a teambubble entity if needed
-       if (!self.teambubbleentity && teams_matter)
-       {
-               self.teambubbleentity = spawn();
-               self.teambubbleentity.owner = self;
-               self.teambubbleentity.exteriormodeltoclient = self;
-               self.teambubbleentity.think = TeamBubbleThink;
-               self.teambubbleentity.nextthink = time;
-               setmodel(self.teambubbleentity, "models/misc/teambubble.spr"); // precision set below
-//             setorigin(self.teambubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1');
-               setorigin(self.teambubbleentity, '0 0 15' + self.maxs_z * '0 0 1');
-               setattachment(self.teambubbleentity, self, "");  // sticks to moving player better, also conserves bandwidth
-               self.teambubbleentity.mdl = self.teambubbleentity.model;
-               self.teambubbleentity.model = self.teambubbleentity.mdl;
-               self.teambubbleentity.customizeentityforclient = TeamBubble_customizeentityforclient;
-               self.teambubbleentity.effects = EF_LOWPRECISION;
-       }
-}
-
 // LordHavoc: this hack will be removed when proper _pants/_shirt layers are
 // added to the model skins
 /*void UpdateColorModHack()
@@ -2045,24 +1986,24 @@ string getTimeoutText(float addOneSecond) {
                else {
                        retStr = strcat("Timeout begins in ", ftos(remainingLeadTime), " seconds!\n");
                }
-               return retStr;
+               return strcat(CPID_TIMEOUT_COUNTDOWN, retStr);
        }
        else if (timeoutStatus == 2) {
                if (addOneSecond) {
                        retStr = strcat("Timeout ends in ", ftos(remainingTimeoutTime + 1), " seconds!\n");
                        //don't show messages like "Timeout ends in 0 seconds"...
                        if ((remainingTimeoutTime + 1) > 0)
-                               return retStr;
+                               return strcat(CPID_TIMEOUT_COUNTDOWN, retStr);
                        else
-                               return "";
+                               return strcat(CPID_TIMEOUT_COUNTDOWN, "");
                }
                else {
                        retStr = strcat("Timeout ends in ", ftos(remainingTimeoutTime), " seconds!\n");
                        //don't show messages like "Timeout ends in 0 seconds"...
-                       if (remainingTimeoutTime > 0)
-                               return retStr;
+                       if ((remainingTimeoutTime) > 0)
+                               return strcat(CPID_TIMEOUT_COUNTDOWN, retStr);
                        else
-                               return "";
+                               return strcat(CPID_TIMEOUT_COUNTDOWN, "");
                }
        }
        else return "";
@@ -2502,7 +2443,7 @@ void LeaveSpectatorMode()
                                bprint ("^4", self.netname, "^4 is playing now\n");
 
                        if(!autocvar_g_campaign)
-                               centerprint(self,""); // clear MOTD
+                               centerprint(self, CPID_MOTD); // clear MOTD
 
                        return;
                } else {
@@ -2960,7 +2901,7 @@ void PlayerPreThink (void)
        }
 
        if(!zoomstate_set)
-               SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_SNIPERRIFLE && autocvar_g_balance_sniperrifle_secondary == 0));
+               SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_RIFLE && autocvar_g_balance_rifle_secondary == 0));
 
        float oldspectatee_status;
        oldspectatee_status = self.spectatee_status;
@@ -3078,7 +3019,7 @@ void PlayerPostThink (void)
                {
                        if(timeleft != self.idlekick_lasttimeleft)
                        {
-                               centerprint_atprio(self, CENTERPRIO_IDLEKICK, strcat("^3Stop idling!\n^3Disconnecting in ", ftos(timeleft), "..."));
+                               centerprint_atprio(self, CENTERPRIO_IDLEKICK, strcat(CPID_DISCONNECT_IDLING, "^3Stop idling!\n^3Disconnecting in ", ftos(timeleft), "..."));
                                AnnounceTo(self, strcat(ftos(timeleft), ""));
                        }
                }
@@ -3101,7 +3042,6 @@ void PlayerPostThink (void)
        if(self.classname == "player") {
                CheckRules_Player();
                UpdateChatBubble();
-               UpdateTeamBubble();
                if (self.impulse)
                        ImpulseCommands();
                if (intermission_running)