]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qh
Fix Welcome message "popping up multiple times in the middle of a match"
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / invasion / sv_invasion.qh
1 #pragma once
2
3 #include <common/mutators/base.qh>
4 #define autocvar_g_invasion_point_limit cvar("g_invasion_point_limit")
5 int autocvar_g_invasion_teams;
6 int autocvar_g_invasion_type;
7 bool autocvar_g_invasion_team_spawns;
8 bool g_invasion;
9 IntrusiveList g_invasion_roundends;
10 IntrusiveList g_invasion_waves;
11 IntrusiveList g_invasion_spawns;
12 void invasion_Initialize();
13
14 REGISTER_MUTATOR(inv, false)
15 {
16     MUTATOR_STATIC();
17         MUTATOR_ONADD
18         {
19                 g_invasion_roundends = IL_NEW();
20                 g_invasion_waves = IL_NEW();
21                 g_invasion_spawns = IL_NEW();
22                 if (autocvar_g_invasion_teams >= 2) {
23                         GameRules_teams(true);
24                         GameRules_spawning_teams(autocvar_g_invasion_team_spawns);
25                 }
26         GameRules_limit_score(autocvar_g_invasion_point_limit);
27
28                 g_invasion = true;
29                 cvar_settemp("g_monsters", "1");
30                 invasion_Initialize();
31         }
32         return 0;
33 }
34
35 float inv_numspawned;
36 float inv_maxspawned;
37 float inv_roundcnt;
38 float inv_maxrounds;
39 float inv_numkilled;
40 float inv_lastcheck;
41 float inv_maxcurrent;
42
43 float invasion_teams;
44 float inv_monsters_perteam[17];
45
46 float inv_monsterskill;
47
48 const float ST_INV_KILLS = 1;
49
50 const int INV_TYPE_ROUND = 0; // round-based waves of enemies
51 const int INV_TYPE_HUNT = 1; // clear the map of placed enemies
52 const int INV_TYPE_STAGE = 2; // reach the end of the level