]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/mutator/gamemode_invasion.qh
Merge branch 'master' into terencehill/hud_updates
[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 bool autocvar_g_invasion_team_spawns;
8 bool g_invasion;
9 void invasion_Initialize();
10
11 REGISTER_MUTATOR(inv, false)
12 {
13         MUTATOR_ONADD
14         {
15                 if (time > 1) // game loads at time 1
16                         error("This is a game type and it cannot be added at runtime.");
17                 g_invasion = true;
18                 invasion_Initialize();
19
20                 cvar_settemp("g_monsters", "1");
21
22                 SetLimits(autocvar_g_invasion_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
23                 if (autocvar_g_invasion_teams >= 2)
24                 {
25                         ActivateTeamplay();
26                         if (autocvar_g_invasion_team_spawns)
27                                 have_team_spawns = -1; // request team spawns
28                 }
29         }
30
31         MUTATOR_ONROLLBACK_OR_REMOVE
32         {
33                 // we actually cannot roll back invasion_Initialize here
34                 // BUT: we don't need to! If this gets called, adding always
35                 // succeeds.
36         }
37
38         MUTATOR_ONREMOVE
39         {
40                 LOG_INFO("This is a game type and it cannot be removed at runtime.");
41                 return -1;
42         }
43
44         return 0;
45 }
46
47 float inv_numspawned;
48 float inv_maxspawned;
49 float inv_roundcnt;
50 float inv_maxrounds;
51 float inv_numkilled;
52 float inv_lastcheck;
53 float inv_maxcurrent;
54
55 float invasion_teams;
56 float inv_monsters_perteam[17];
57
58 float inv_monsterskill;
59
60 const float ST_INV_KILLS = 1;