]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/mutator/gamemode_tdm.qh
5946f84a870e2bf4f1cb11bfac9eaa05180e7bf2
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_tdm.qh
1 #pragma once
2
3 #include "../gamemode.qh"
4
5 int autocvar_g_tdm_point_limit;
6 int autocvar_g_tdm_point_leadlimit;
7 bool autocvar_g_tdm_team_spawns;
8 void tdm_DelayedInit(entity this);
9
10 REGISTER_MUTATOR(tdm, 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                 InitializeEntity(NULL, tdm_DelayedInit, INITPRIO_GAMETYPE);
17
18                 GameRules_teams(true);
19                 GameRules_limit_score(autocvar_g_tdm_point_limit);
20         GameRules_limit_lead(autocvar_g_tdm_point_leadlimit);
21                 if (autocvar_g_tdm_team_spawns)
22                         have_team_spawns = -1; // request team spawns
23         }
24
25         MUTATOR_ONROLLBACK_OR_REMOVE
26         {
27                 // we actually cannot roll back tdm_Initialize here
28                 // BUT: we don't need to! If this gets called, adding always
29                 // succeeds.
30         }
31
32         MUTATOR_ONREMOVE
33         {
34                 LOG_INFO("This is a game type and it cannot be removed at runtime.");
35                 return -1;
36         }
37
38         return 0;
39 }