]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/mutator/gamemode_keyhunt.qh
Merge branch 'master' into TimePath/modules
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_keyhunt.qh
1 #pragma once
2
3 #include "../gamemode.qh"
4
5 #define autocvar_g_keyhunt_point_limit cvar("g_keyhunt_point_limit")
6 int autocvar_g_keyhunt_point_leadlimit;
7 bool autocvar_g_keyhunt_team_spawns;
8 void kh_Initialize();
9
10 REGISTER_MUTATOR(kh, false)
11 {
12         MUTATOR_ONADD
13         {
14                 if (time > 1) // game loads at time 1
15                         error("This is a game type and it cannot be added at runtime.");
16                 kh_Initialize();
17
18                 ActivateTeamplay();
19                 SetLimits(autocvar_g_keyhunt_point_limit, autocvar_g_keyhunt_point_leadlimit, autocvar_timelimit_override, -1);
20                 if (autocvar_g_keyhunt_team_spawns)
21                         have_team_spawns = -1; // request team spawns
22         }
23
24         MUTATOR_ONROLLBACK_OR_REMOVE
25         {
26                 // we actually cannot roll back kh_Initialize here
27                 // BUT: we don't need to! If this gets called, adding always
28                 // succeeds.
29         }
30
31         MUTATOR_ONREMOVE
32         {
33                 LOG_INFO("This is a game type and it cannot be removed at runtime.");
34                 return -1;
35         }
36
37         return 0;
38 }
39
40 #define FOR_EACH_KH_KEY(v) for(v = kh_worldkeylist; v; v = v.kh_worldkeynext )
41
42 // ALL OF THESE should be removed in the future, as other code should not have to care
43
44 // used by bots:
45 float kh_tracking_enabled;
46 .entity kh_next;
47 float kh_Key_AllOwnedByWhichTeam();
48
49 USING(kh_Think_t, void());
50 void kh_StartRound();
51 void kh_Controller_SetThink(float t, kh_Think_t func);