]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/mutator/gamemode_freezetag.qh
Refactor game rules
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_freezetag.qh
1 #pragma once
2
3 #include "../gamemode.qh"
4
5 int autocvar_g_freezetag_point_limit;
6 int autocvar_g_freezetag_point_leadlimit;
7 bool autocvar_g_freezetag_team_spawns;
8 void freezetag_Initialize();
9
10 REGISTER_MUTATOR(ft, 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                 freezetag_Initialize();
17
18                 GameRules_teams(true);
19         GameRules_limit_score(autocvar_g_freezetag_point_limit);
20         GameRules_limit_lead(autocvar_g_freezetag_point_leadlimit);
21
22                 if (autocvar_g_freezetag_team_spawns)
23                         have_team_spawns = -1; // request team spawns
24         }
25
26         MUTATOR_ONROLLBACK_OR_REMOVE
27         {
28                 // we actually cannot roll back freezetag_Initialize here
29                 // BUT: we don't need to! If this gets called, adding always
30                 // succeeds.
31         }
32
33         MUTATOR_ONREMOVE
34         {
35                 LOG_INFO("This is a game type and it cannot be removed at runtime.");
36                 return -1;
37         }
38
39         return 0;
40 }
41
42 .float freezetag_frozen_time;
43 .float freezetag_frozen_timeout;
44 const float ICE_MAX_ALPHA = 1;
45 const float ICE_MIN_ALPHA = 0.1;
46 float freezetag_teams;
47
48 .float reviving; // temp var
49
50 float autocvar_g_freezetag_revive_extra_size;
51 float autocvar_g_freezetag_revive_speed;
52 bool autocvar_g_freezetag_revive_nade;
53 float autocvar_g_freezetag_revive_nade_health;