]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/teamplay.qc
Teamplay: Made team balance entities destroy themselves on the next frame.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / teamplay.qc
index 3faa2d8a83cb24f00ce0472359ee7e5859224e62..25acdd3e01595b82a8f584c44bb8f8a72bf1e2d0 100644 (file)
@@ -9,10 +9,10 @@
 
 #include "command/vote.qh"
 
-#include "mutators/_mod.qh"
+#include <server/mutators/_mod.qh>
 
 #include "../common/deathtypes/all.qh"
-#include "../common/gamemodes/_mod.qh"
+#include <common/gamemodes/_mod.qh>
 #include "../common/teams.qh"
 
 /// \brief Describes a state of team balance entity.
@@ -185,7 +185,11 @@ bool Player_SetTeamIndex(entity player, int index)
                // Mutator has blocked team change.
                return false;
        }
-       if (new_team != -1)
+       if (new_team == -1)
+       {
+               player.team = -1;
+       }
+       else
        {
                SetPlayerColors(player, new_team - 1);
        }
@@ -260,6 +264,7 @@ entity TeamBalance_CheckAllowedTeams(entity for_whom)
                team_ent.m_num_players = TEAM_NOT_ALLOWED;
                team_ent.m_num_bots = 0;
        }
+       setthink(balance, TeamBalance_Destroy);
        
        int teams_mask = 0;     
        string teament_name = string_null;