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