]> de.git.xonotic.org Git - voretournament/voretournament.git/blob - data/qcsrc/server/scores.qh
Grabber: Don't behave differently while the player is crouching. Fixes a bug
[voretournament/voretournament.git] / data / qcsrc / server / scores.qh
1 entity scores_initialized; // non-world when scores labels/rules have been set\r
2 .float scores[MAX_SCORE];\r
3 .float teamscores[MAX_TEAMSCORE];\r
4 \r
5 /**\r
6  * Attaches a PlayerScore entity to a player. Use that in ClientConnect.\r
7  * Remember to detach it in ClientDisconnect!\r
8  */\r
9 void PlayerScore_Attach(entity player);\r
10 \r
11 /**\r
12  * Detaches a PlayerScore entity from the player. Use that in ClientDisconnect.\r
13  */\r
14 void PlayerScore_Detach(entity player);\r
15 \r
16 /**\r
17  * Adds a score to the player's scores.\r
18  * NEVER call this if PlayerScore_Attach has not been called yet!\r
19  * Means: FIXME make players unable to join the game when not called ClientConnect yet.\r
20  * Returns the new score.\r
21  */\r
22 float PlayerScore_Add(entity player, float scorefield, float score);\r
23 \r
24 /**\r
25  * Initialize the score of this player if needed.\r
26  * Does nothing in teamplay.\r
27  * Use that when a spectator becomes a player.\r
28  */\r
29 void PlayerScore_Clear(entity player);\r
30 \r
31 /**\r
32  * Adds a score to the player's team's scores.\r
33  * NEVER call this if team has not been set yet!\r
34  * Returns the new score.\r
35  */\r
36 float TeamScore_Add(entity player, float scorefield, float score);\r
37 \r
38 /**\r
39  * Adds a score to the given team.\r
40  * NEVER call this if team has not been set yet!\r
41  * Returns the new score.\r
42  */\r
43 float TeamScore_AddToTeam(float t, float scorefield, float score);\r
44 \r
45 /**\r
46  * Returns a value indicating the team score (and higher is better).\r
47  */\r
48 float TeamScore_GetCompareValue(float t);\r
49 \r
50 /**\r
51  * Adds a score to both the player and the team. Returns the team score if\r
52  * possible, otherwise the player score.\r
53  */\r
54 float PlayerTeamScore_Add(entity player, float pscorefield, float tscorefield, float score);\r
55 \r
56 /**\r
57  * Adds to the generic score fields for both the player and the team.\r
58  */\r
59 #define PlayerTeamScore_AddScore(p,s) PlayerTeamScore_Add(p, SP_SCORE, ST_SCORE, s)\r
60 \r
61 /**\r
62  * Set the label of a team score item, as well as the scoring flags.\r
63  */\r
64 void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags);\r
65 \r
66 /**\r
67  * Set the label of a player score item, as well as the scoring flags.\r
68  */\r
69 void ScoreInfo_SetLabel_PlayerScore(float i, string label, float scoreflags);\r
70 \r
71 /**\r
72  * Initialize the scores info for the given number of teams.\r
73  * Set all labels right before this call.\r
74  */\r
75 void ScoreInfo_Init(float teams);\r
76 \r
77 /**\r
78  * Clear ALL scores (for ready-restart).\r
79  */\r
80 void Score_ClearAll();\r
81 \r
82 /**\r
83  * Prints the scores to the console of a player.\r
84  */\r
85 void Score_NicePrint(entity to);\r
86 \r
87 /**\r
88  * Sets the following results for the current scores entities.\r
89  */\r
90 void WinningConditionHelper();\r
91 float WinningConditionHelper_topscore;      ///< highest score\r
92 float WinningConditionHelper_secondscore;   ///< second highest score\r
93 float WinningConditionHelper_winnerteam;    ///< the color of the winning team, or -1 if none\r
94 float WinningConditionHelper_secondteam;    ///< the color of the second team, or -1 if none\r
95 float WinningConditionHelper_equality;      ///< we have no winner\r
96 entity WinningConditionHelper_winner;       ///< the winning player, or world if none\r
97 entity WinningConditionHelper_second;       ///< the second player, or world if none\r
98 float WinningConditionHelper_lowerisbetter; ///< lower is better, duh\r
99 float WinningConditionHelper_zeroisworst;   ///< zero is worst, duh\r
100 #define WINNINGCONDITIONHELPER_LOWERISBETTER_WORST 999999999\r
101 \r
102 /**\r
103  * Returns score strings for eventlog etc.\r
104  * When called with world, or 0, as argument, they return the labels in the\r
105  * same order.\r
106  * The strings are comma separated; labels that end with !! designate primary,\r
107  * labels that end with ! designate high priority.\r
108  * Labels get an appended < if the scores are better if smaller (e.g. deaths).\r
109  * High priorities always come first.\r
110  * Example label string: score!!,kills,deaths<,suicides<\r
111  * If shortString is set, only the sort keys are returned.\r
112  */\r
113 string GetPlayerScoreString(entity pl, float shortString);\r
114 string GetTeamScoreString(float tm, float shortString);\r
115 \r
116 /**\r
117  * Sorts the players and stores their place in the given field, starting with\r
118  * 1. Non-players get 0 written into that field.\r
119  * Returns the beginning of a sorted chain of the non-spectators.\r
120  */\r
121 entity PlayerScore_Sort(.float field);\r