]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/teamplay.qh
Removed ShufflePlayerOutOfTeam as it is never used and contains horrible bugs.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / teamplay.qh
1 #pragma once
2
3 string cache_mutatormsg;
4 string cache_lastmutatormsg;
5
6 // The following variables are used for balancing. They are not updated
7 // automatically. You need to call CheckAllowedTeams and GetTeamCounts to get
8 // proper values.
9
10 // These four have 2 different states. If they are equal to -1, it means that
11 // the player can't join the team. Zero or positive value means that player can
12 // join the team and means the number of players on that team.
13 float c1;
14 float c2;
15 float c3;
16 float c4;
17 float numbotsteam1; ///< Number of bots in the first team.
18 float numbotsteam2; ///< Number of bots in the second team.
19 float numbotsteam3; ///< Number of bots in the third team.
20 float numbotsteam4; ///< Number of bots in the fourth team.
21 entity lowesthumanteam1; ///< Human with the lowest score in the first team.
22 entity lowesthumanteam2; ///< Human with the lowest score in the second team.
23 entity lowesthumanteam3; ///< Human with the lowest score in the third team.
24 entity lowesthumanteam4; ///< Human with the lowest score in the fourth team.
25 entity lowestbotteam1; ///< Bot with the lowest score in the first team.
26 entity lowestbotteam2; ///< Bot with the lowest score in the second team.
27 entity lowestbotteam3; ///< Bot with the lowest score in the third team.
28 entity lowestbotteam4; ///< Bot with the lowest score in the fourth team.
29
30 int redowned, blueowned, yellowowned, pinkowned;
31
32 //float audit_teams_time;
33
34 void TeamchangeFrags(entity e);
35
36 void LogTeamchange(float player_id, float team_number, float type);
37
38 void default_delayedinit(entity this);
39
40 void ActivateTeamplay();
41
42 void InitGameplayMode();
43
44 string GetClientVersionMessage(entity this);
45
46 string getwelcomemessage(entity this);
47
48 void SetPlayerColors(entity player, float _color);
49
50 /// \brief Sets the team of the player.
51 /// \param[in,out] player Player to adjust.
52 /// \param[in] teamnum Team number to set. See TEAM_NUM constants.
53 /// \return True if team switch was successful, false otherwise.
54 bool SetPlayerTeamSimple(entity player, int teamnum);
55
56 /// \brief Sets the team of the player.
57 /// \param[in,out] player Player to adjust.
58 /// \param[in] destinationteam Team to set.
59 /// \param[in] sourceteam Previous team of the player.
60 /// \param[in] noprint Whether to print this event to players' console.
61 /// \return True if team switch was successful, false otherwise.
62 bool SetPlayerTeam(entity player, int destinationteam, int sourceteam, bool noprint);
63
64 // set c1...c4 to show what teams are allowed
65 void CheckAllowedTeams (entity for_whom);
66
67 float PlayerValue(entity p);
68
69 // c1...c4 should be set to -1 (not allowed) or 0 (allowed).
70 // teams that are allowed will now have their player counts stored in c1...c4
71 void GetTeamCounts(entity ignore);
72
73 /// \brief Returns whether one team is smaller than the other.
74 /// \param[in] teama First team.
75 /// \param[in] teamb Second team.
76 /// \param[in] e Player to check.
77 /// \param[in] usescore Whether to take into account team scores.
78 /// \return True if first team is smaller than the second one, false otherwise.
79 /// \note This function assumes that CheckAllowedTeams and GetTeamCounts have
80 /// been called.
81 bool IsTeamSmallerThanTeam(int teama, int teamb, entity e, bool usescore);
82
83 /// \brief Returns whether one team is equal to the other.
84 /// \param[in] teama First team.
85 /// \param[in] teamb Second team.
86 /// \param[in] e Player to check.
87 /// \param[in] usescore Whether to take into account team scores.
88 /// \return True if first team is equal to the second one, false otherwise.
89 /// \note This function assumes that CheckAllowedTeams and GetTeamCounts have
90 /// been called.
91 bool IsTeamEqualToTeam(int teama, int teamb, entity e, bool usescore);
92
93 /// \brief Returns the bitmask of the best teams for the player to join.
94 /// \param[in] player Player to check.
95 /// \param[in] usescore Whether to take into account team scores.
96 /// \return Bitmask of the best teams for the player to join.
97 /// \note This function assumes that CheckAllowedTeams and GetTeamCounts have
98 /// been called.
99 int FindBestTeams(entity player, bool usescore);
100
101 // returns # of smallest team (1, 2, 3, 4)
102 // NOTE: Assumes CheckAllowedTeams has already been called!
103 float FindSmallestTeam(entity player, float ignore_player);
104
105 int JoinBestTeam(entity this, bool only_return_best, bool forcebestteam);
106
107 /// \brief Auto balances bots in teams after the player has changed team.
108 /// \param[in] sourceteam Previous team of the player (1, 2, 3, 4).
109 /// \param[in] destinationteam Current team of the player (1, 2, 3, 4).
110 /// \return No return.
111 /// \note This function assumes that CheckAllowedTeams and GetTeamCounts have
112 /// been called.
113 void AutoBalanceBots(int sourceteam, int destinationteam);
114
115 void setcolor(entity this, int clr);