GameRules: make `GameRules_teams(true)` imply `have_team_spawns = -1`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / sv_rules.qh
1 #pragma once
2
3 // todo: accept the number of teams as a parameter
4 void GameRules_teams(bool value);
5
6 /**
7  * Used to disable team spawns in team modes
8  */
9 void GameRules_spawning_teams(bool value);
10
11 /**
12  * Disabling score disables the "score" column on the scoreboard
13  */
14 void GameRules_score_enabled(bool value);
15
16 void GameRules_limit_score(int limit);
17 void GameRules_limit_lead(int limit);
18 void GameRules_limit_time(int limit);
19 void GameRules_limit_time_qualifying(int limit);
20
21 /**
22  * Set any unspecified rules to their defaults
23  */
24 void GameRules_limit_fallbacks();
25
26 // derive score_enabled from !frags_enabled
27
28 /**
29  * @param teams a bitmask of active teams
30  * @param spprio player score priority (if frags aren't enabled)
31  * @param stprio team score priority (if frags aren't enabled)
32  */
33 #define GameRules_scoring(teams, spprio, stprio, fields) MACRO_BEGIN { \
34     _GameRules_scoring_begin((teams), (spprio), (stprio)); \
35     noref void(entity, string, float) field = _GameRules_scoring_field; \
36     /* todo: just have the one `field` function */ \
37     noref void(int, string, float) field_team = _GameRules_scoring_field_team; \
38     LAMBDA(fields); \
39     _GameRules_scoring_end(); \
40 } MACRO_END
41
42 void _GameRules_scoring_begin(int teams, float spprio, float stprio);
43 void _GameRules_scoring_field(entity i, string label, int scoreflags);
44 void _GameRules_scoring_field_team(float i, string label, int scoreflags);
45 void _GameRules_scoring_end();