]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/mutator/gamemode_cts.qh
Refactor game rules
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_cts.qh
1 #pragma once
2
3 #include "../gamemode.qh"
4 #include <server/race.qh>
5
6 void cts_Initialize();
7
8 REGISTER_MUTATOR(cts, false)
9 {
10         MUTATOR_ONADD
11         {
12                 if (time > 1) // game loads at time 1
13                         error("This is a game type and it cannot be added at runtime.");
14
15                 g_race_qualifying = true;
16                 independent_players = 1;
17         GameRules_limit_score(0);
18         GameRules_limit_lead(0);
19
20                 cts_Initialize();
21         }
22
23         MUTATOR_ONROLLBACK_OR_REMOVE
24         {
25                 // we actually cannot roll back cts_Initialize here
26                 // BUT: we don't need to! If this gets called, adding always
27                 // succeeds.
28         }
29
30         MUTATOR_ONREMOVE
31         {
32                 LOG_INFO("This is a game type and it cannot be removed at runtime.");
33                 return -1;
34         }
35
36         return 0;
37 }
38
39 // scores
40 const float ST_CTS_LAPS = 1;