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