]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/mutator/gamemode_invasion.qh
aad484cbfbac72f0ebd73a00531f4d46e90c4045
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_invasion.qh
1 #pragma once
2
3 #include "../gamemode.qh"
4
5 #define autocvar_g_invasion_point_limit cvar("g_invasion_point_limit")
6 int autocvar_g_invasion_teams;
7 int autocvar_g_invasion_type;
8 bool autocvar_g_invasion_team_spawns;
9 bool g_invasion;
10 void invasion_Initialize();
11
12 REGISTER_MUTATOR(inv, 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                 g_invasion = true;
19                 invasion_Initialize();
20
21                 cvar_settemp("g_monsters", "1");
22
23         GameRules_limit_score(autocvar_g_invasion_point_limit);
24
25                 if (autocvar_g_invasion_teams >= 2)
26                 {
27                         GameRules_teams(true);
28                         if (autocvar_g_invasion_team_spawns)
29                                 have_team_spawns = -1; // request team spawns
30                 }
31         }
32
33         MUTATOR_ONROLLBACK_OR_REMOVE
34         {
35                 // we actually cannot roll back invasion_Initialize here
36                 // BUT: we don't need to! If this gets called, adding always
37                 // succeeds.
38         }
39
40         MUTATOR_ONREMOVE
41         {
42                 LOG_INFO("This is a game type and it cannot be removed at runtime.");
43                 return -1;
44         }
45
46         return 0;
47 }
48
49 float inv_numspawned;
50 float inv_maxspawned;
51 float inv_roundcnt;
52 float inv_maxrounds;
53 float inv_numkilled;
54 float inv_lastcheck;
55 float inv_maxcurrent;
56
57 float invasion_teams;
58 float inv_monsters_perteam[17];
59
60 float inv_monsterskill;
61
62 const float ST_INV_KILLS = 1;
63
64 const int INV_TYPE_ROUND = 0; // round-based waves of enemies
65 const int INV_TYPE_HUNT = 1; // clear the map of placed enemies
66 const int INV_TYPE_STAGE = 2; // reach the end of the level