GameRules: make `GameRules_teams(true)` imply `have_team_spawns = -1`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_domination.qh
1 #pragma once
2
3 #include "../gamemode.qh"
4
5 #define autocvar_g_domination_point_limit cvar("g_domination_point_limit")
6 bool autocvar_g_domination_roundbased;
7 int autocvar_g_domination_roundbased_point_limit;
8 int autocvar_g_domination_point_leadlimit;
9
10 void dom_Initialize();
11
12 REGISTER_MUTATOR(dom, false)
13 {
14         MUTATOR_ONADD
15         {
16                 if (time > 1) // game loads at time 1
17                         error("This is a game type and it cannot be added at runtime.");
18                 dom_Initialize();
19
20                 int fraglimit_override = autocvar_g_domination_point_limit;
21                 if (autocvar_g_domination_roundbased && autocvar_g_domination_roundbased_point_limit)
22                         fraglimit_override = autocvar_g_domination_roundbased_point_limit;
23
24                 GameRules_teams(true);
25         GameRules_limit_score(fraglimit_override);
26         GameRules_limit_lead(autocvar_g_domination_point_leadlimit);
27         }
28
29         MUTATOR_ONREMOVE
30         {
31                 LOG_INFO("This is a game type and it cannot be removed at runtime.");
32                 return -1;
33         }
34
35         return 0;
36 }
37
38 // score rule declarations
39 const float ST_DOM_TICKS = 1;
40 const float ST_DOM_CAPS = 1;
41
42 // pps: points per second
43 .float dom_total_pps = _STAT(DOM_TOTAL_PPS);
44 .float dom_pps_red = _STAT(DOM_PPS_RED);
45 .float dom_pps_blue = _STAT(DOM_PPS_BLUE);
46 .float dom_pps_yellow = _STAT(DOM_PPS_YELLOW);
47 .float dom_pps_pink = _STAT(DOM_PPS_PINK);
48 float total_pps;
49 float pps_red;
50 float pps_blue;
51 float pps_yellow;
52 float pps_pink;
53
54 // capture declarations
55 .float enemy_playerid;
56 .entity sprite;
57 .float captime;
58
59 // misc globals
60 float domination_roundbased;
61 float domination_teams;
62
63 void AnimateDomPoint(entity this);
64
65 IntrusiveList g_dompoints;
66 STATIC_INIT(g_dompoints) { g_dompoints = IL_NEW(); }