]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/teamplay.qh
ClientCommand_selectteam improvement.
[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 num_bots_team1; ///< Number of bots in the first team.
18 float num_bots_team2; ///< Number of bots in the second team.
19 float num_bots_team3; ///< Number of bots in the third team.
20 float num_bots_team4; ///< Number of bots in the fourth team.
21 entity lowest_human_team1; ///< Human with the lowest score in the first team.
22 entity lowest_human_team2; ///< Human with the lowest score in the second team.
23 entity lowest_human_team3; ///< Human with the lowest score in the third team.
24 entity lowest_human_team4; ///< Human with the lowest score in the fourth team.
25 entity lowest_bot_team1; ///< Bot with the lowest score in the first team.
26 entity lowest_bot_team2; ///< Bot with the lowest score in the second team.
27 entity lowest_bot_team3; ///< Bot with the lowest score in the third team.
28 entity lowest_bot_team4; ///< 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 Kills player as a result of team change.
51 /// \param[in,out] player Player to kill.
52 /// \return No return.
53 void KillPlayerForTeamChange(entity player);
54
55 /// \brief Sets the team of the player.
56 /// \param[in,out] player Player to adjust.
57 /// \param[in] team_num Team number to set. See TEAM_NUM constants.
58 /// \return True if team switch was successful, false otherwise.
59 bool SetPlayerTeamSimple(entity player, int team_num);
60
61 /// \brief Sets the team of the player.
62 /// \param[in,out] player Player to adjust.
63 /// \param[in] destination_team Team to set.
64 /// \param[in] source_team Previous team of the player.
65 /// \param[in] no_print Whether to print this event to players' console.
66 /// \return True if team switch was successful, false otherwise.
67 bool SetPlayerTeam(entity player, int destination_team, int source_team,
68         bool no_print);
69
70 // set c1...c4 to show what teams are allowed
71 void CheckAllowedTeams(entity for_whom);
72
73 float PlayerValue(entity p);
74
75 // c1...c4 should be set to -1 (not allowed) or 0 (allowed).
76 // teams that are allowed will now have their player counts stored in c1...c4
77 void GetTeamCounts(entity ignore);
78
79 /// \brief Returns whether one team is smaller than the other.
80 /// \param[in] team_a First team.
81 /// \param[in] team_b Second team.
82 /// \param[in] player Player to check.
83 /// \param[in] use_score Whether to take into account team scores.
84 /// \return True if first team is smaller than the second one, false otherwise.
85 /// \note This function assumes that CheckAllowedTeams and GetTeamCounts have
86 /// been called.
87 bool IsTeamSmallerThanTeam(int team_a, int team_b, entity player,
88         bool use_score);
89
90 /// \brief Returns whether one team is equal to the other.
91 /// \param[in] team_a First team.
92 /// \param[in] team_b Second team.
93 /// \param[in] player Player to check.
94 /// \param[in] use_score Whether to take into account team scores.
95 /// \return True if first team is equal to the second one, false otherwise.
96 /// \note This function assumes that CheckAllowedTeams and GetTeamCounts have
97 /// been called.
98 bool IsTeamEqualToTeam(int team_a, int team_b, entity player, bool use_score);
99
100 /// \brief Returns the bitmask of the best teams for the player to join.
101 /// \param[in] player Player to check.
102 /// \param[in] use_score Whether to take into account team scores.
103 /// \return Bitmask of the best teams for the player to join.
104 /// \note This function assumes that CheckAllowedTeams and GetTeamCounts have
105 /// been called.
106 int FindBestTeams(entity player, bool use_score);
107
108 // returns # of smallest team (1, 2, 3, 4)
109 // NOTE: Assumes CheckAllowedTeams has already been called!
110 int FindSmallestTeam(entity player, float ignore_player);
111
112 int JoinBestTeam(entity this, bool only_return_best, bool force_best_team);
113
114 /// \brief Auto balances bots in teams after the player has changed team.
115 /// \param[in] source_team Previous team of the player (1, 2, 3, 4).
116 /// \param[in] destination_team Current team of the player (1, 2, 3, 4).
117 /// \return No return.
118 /// \note This function assumes that CheckAllowedTeams and GetTeamCounts have
119 /// been called.
120 void AutoBalanceBots(int source_team, int destination_team);
121
122 void setcolor(entity this, int clr);