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