]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/sv_rules.qh
Merge branch 'TimePath/gamerules' into 'master'
[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 /**
27  * @param teams a bitmask of active teams
28  * @param spprio player score priority (if frags aren't enabled)
29  * @param stprio team score priority (if frags aren't enabled)
30  */
31 #define GameRules_scoring(teams, spprio, stprio, fields) MACRO_BEGIN { \
32     _GameRules_scoring_begin((teams), (spprio), (stprio)); \
33     noref void(entity, string, float) field = _GameRules_scoring_field; \
34     /* todo: just have the one `field` function */ \
35     noref void(int, string, float) field_team = _GameRules_scoring_field_team; \
36     LAMBDA(fields); \
37     _GameRules_scoring_end(); \
38 } MACRO_END
39
40 void _GameRules_scoring_begin(int teams, float spprio, float stprio);
41 void _GameRules_scoring_field(entity i, string label, int scoreflags);
42 void _GameRules_scoring_field_team(float i, string label, int scoreflags);
43 void _GameRules_scoring_end();
44
45 /**
46  * Mark a player as being 'important' (flag carrier, ball carrier, etc)
47  * @param player the entity to mark
48  * @param value VIP status
49  */
50 void GameRules_scoring_vip(entity player, bool value);
51 bool GameRules_scoring_is_vip(entity player);
52
53 #define GameRules_scoring_add(client, fld, value) _GameRules_scoring_add(client, SP_##fld, value)
54 float _GameRules_scoring_add(entity client, entity sp, float value);
55 #define GameRules_scoring_add_team(client, fld, value) _GameRules_scoring_add_team(client, SP_##fld, ST_##fld, value)
56 float _GameRules_scoring_add_team(entity client, entity sp, int st, float value);