]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_client.qc
Merge remote branch 'origin/terencehill/physics_panel_updates'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index ebf4abc4b4d85bc7181fd408221f03c75df988a4..0ba761f453cc05c3cdb091d447b58123861e302c 100644 (file)
@@ -645,6 +645,7 @@ Called when a client spawns in the server
 =============
 */
 //void() ctf_playerchanged;
+
 void PutClientInServer (void)
 {
        if(clienttype(self) == CLIENTTYPE_BOT)
@@ -967,6 +968,7 @@ float ClientInit_SendEntity(entity to, float sf)
        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
        WriteCoord(MSG_ENTITY, autocvar_g_trueaim_minrange);
+       WriteByte(MSG_ENTITY, autocvar_g_balance_porto_secondary);
        return TRUE;
 }
 
@@ -1595,8 +1597,12 @@ void ClientConnect (void)
        CSQCMODEL_AUTOINIT();
 
        self.model_randomizer = random();
+    
+    if(clienttype(self) != CLIENTTYPE_REAL)
+        return;
+        
+    sv_notice_join();
 }
-
 /*
 =============
 ClientDisconnect
@@ -1895,7 +1901,8 @@ void player_powerups (void)
                }
                if (self.items & IT_SUPERWEAPON)
                {
-                       self.effects = self.effects | EF_RED;
+                       //if(W_WeaponBit(self.weapon) & WEPBIT_SUPERWEAPONS)
+                       //      self.effects = self.effects | EF_RED;
                        if (!(self.weapons & WEPBIT_SUPERWEAPONS))
                        {
                                self.superweapons_finished = 0;
@@ -1917,15 +1924,22 @@ void player_powerups (void)
                                }
                        }
                }
-               else
+               else if(self.weapons & WEPBIT_SUPERWEAPONS)
                {
-                       if (time < self.superweapons_finished)
+                       if (time < self.superweapons_finished || (self.items & IT_UNLIMITED_SUPERWEAPONS))
                        {
                                self.items = self.items | IT_SUPERWEAPON;
                                sprint(self, "^3You now have a superweapon\n");
                        }
                        else
+                       {
+                               self.superweapons_finished = 0;
                                self.weapons &~= WEPBIT_SUPERWEAPONS; // just in case
+                       }
+               }
+               else
+               {
+                       self.superweapons_finished = 0;
                }
        }
        
@@ -2305,7 +2319,7 @@ void ShowRespawnCountdown()
 .float prevent_join_msgtime;
 void LeaveSpectatorMode()
 {
-       if(nJoinAllowed(1)) {
+       if(nJoinAllowed(self)) {
                if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0) {
                        self.classname = "player";
 
@@ -2355,26 +2369,36 @@ void LeaveSpectatorMode()
  * it checks whether the number of currently playing players exceeds g_maxplayers.
  * @return int number of free slots for players, 0 if none
  */
-float nJoinAllowed(float includeMe) {
+float nJoinAllowed(entity ignore) {
+       if(!ignore)
+       // this is called that way when checking if anyone may be able to join (to build qcstatus)
+       // so report 0 free slots if restricted
+       {
+               if(autocvar_g_forced_team_otherwise == "spectate")
+                       return 0;
+               if(autocvar_g_forced_team_otherwise == "spectator")
+                       return 0;
+       }
+
        if(self.team_forced < 0)
-               return FALSE; // forced spectators can never join
+               return 0; // forced spectators can never join
 
        // TODO simplify this
        entity e;
-
        float totalClients;
        FOR_EACH_CLIENT(e)
-               totalClients += 1;
+               if(e != ignore)
+                       totalClients += 1;
 
        if (!autocvar_g_maxplayers)
-               return maxclients - totalClients + includeMe;
+               return maxclients - totalClients;
 
        float currentlyPlaying;
        FOR_EACH_REALPLAYER(e)
                currentlyPlaying += 1;
 
        if(currentlyPlaying < autocvar_g_maxplayers)
-               return min(maxclients - totalClients + includeMe, autocvar_g_maxplayers - currentlyPlaying);
+               return min(maxclients - totalClients, autocvar_g_maxplayers - currentlyPlaying);
 
        return 0;
 }