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