]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/sv_rules.qh
Merge branch 'master' into Lyberta/TeamplayOverhaul
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / sv_rules.qh
1 #pragma once
2
3 // TODO: find a better location for these?
4 float total_players;
5
6 // todo: accept the number of teams as a parameter
7 void GameRules_teams(bool value);
8
9 /**
10  * Used to disable team spawns in team modes
11  */
12 void GameRules_spawning_teams(bool value);
13
14 /**
15  * Disabling score disables the "score" column on the scoreboard
16  */
17 void GameRules_score_enabled(bool value);
18
19 void GameRules_limit_score(int limit);
20 void GameRules_limit_lead(int limit);
21 void GameRules_limit_time(int limit);
22 void GameRules_limit_time_qualifying(int limit);
23
24 /**
25  * Set any unspecified rules to their defaults
26  */
27 void GameRules_limit_fallbacks();
28
29 /**
30  * @param teams a bitmask of active teams
31  * @param spprio player score priority (if frags aren't enabled)
32  * @param stprio team score priority (if frags aren't enabled)
33  */
34 #define GameRules_scoring(teams, spprio, stprio, fields) MACRO_BEGIN { \
35     _GameRules_scoring_begin((teams), (spprio), (stprio)); \
36     noref void(entity, string, float) field = _GameRules_scoring_field; \
37     /* todo: just have the one `field` function */ \
38     noref void(int, string, float) field_team = _GameRules_scoring_field_team; \
39     LAMBDA(fields); \
40     _GameRules_scoring_end(); \
41 } MACRO_END
42
43 void _GameRules_scoring_begin(int teams, float spprio, float stprio);
44 void _GameRules_scoring_field(entity i, string label, int scoreflags);
45 void _GameRules_scoring_field_team(float i, string label, int scoreflags);
46 void _GameRules_scoring_end();
47
48 /**
49  * Mark a player as being 'important' (flag carrier, ball carrier, etc)
50  * @param player the entity to mark
51  * @param value VIP status
52  */
53 void GameRules_scoring_vip(entity player, bool value);
54 bool GameRules_scoring_is_vip(entity player);
55
56 #define GameRules_scoring_add(client, fld, value) _GameRules_scoring_add(client, SP_##fld, value)
57 float _GameRules_scoring_add(entity client, entity sp, float value);
58 #define GameRules_scoring_add_team(client, fld, value) _GameRules_scoring_add_team(client, SP_##fld, ST_##fld, value)
59 float _GameRules_scoring_add_team(entity client, entity sp, int st, float value);