Merge branch 'master' into Mario/vaporizer_damage
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator_midair.qc
1 #include "../_all.qh"
2
3 #include "mutator.qh"
4
5 .float midair_shieldtime;
6
7 MUTATOR_HOOKFUNCTION(midair_PlayerDamage)
8 {
9         if(IS_PLAYER(frag_attacker))
10         if(IS_PLAYER(frag_target))
11         if(time < self.midair_shieldtime)
12                 frag_damage = false;
13
14         return false;
15 }
16
17 MUTATOR_HOOKFUNCTION(midair_PlayerPowerups)
18 {
19         if(time >= game_starttime)
20         if(self.flags & FL_ONGROUND)
21         {
22                 self.effects |= (EF_ADDITIVE | EF_FULLBRIGHT);
23                 self.midair_shieldtime = max(self.midair_shieldtime, time + autocvar_g_midair_shieldtime);
24         }
25
26         return false;
27 }
28
29 MUTATOR_HOOKFUNCTION(midair_PlayerSpawn)
30 {
31         if(IS_BOT_CLIENT(self))
32                 self.bot_moveskill = 0; // disable bunnyhopping
33
34         return false;
35 }
36
37 MUTATOR_HOOKFUNCTION(midair_BuildMutatorsString)
38 {
39         ret_string = strcat(ret_string, ":midair");
40         return false;
41 }
42
43 MUTATOR_HOOKFUNCTION(midair_BuildMutatorsPrettyString)
44 {
45         ret_string = strcat(ret_string, ", Midair");
46         return false;
47 }
48
49 MUTATOR_DEFINITION(mutator_midair)
50 {
51         MUTATOR_HOOK(PlayerDamage_Calculate, midair_PlayerDamage, CBC_ORDER_ANY);
52         MUTATOR_HOOK(PlayerPowerups, midair_PlayerPowerups, CBC_ORDER_ANY);
53         MUTATOR_HOOK(PlayerSpawn, midair_PlayerSpawn, CBC_ORDER_ANY);
54         MUTATOR_HOOK(BuildMutatorsString, midair_BuildMutatorsString, CBC_ORDER_ANY);
55         MUTATOR_HOOK(BuildMutatorsPrettyString, midair_BuildMutatorsPrettyString, CBC_ORDER_ANY);
56
57         return false;
58 }