Improve indentation consistency in client.qc
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / midair / sv_midair.qc
1 #include "sv_midair.qh"
2
3 string autocvar_g_midair;
4 float autocvar_g_midair_shieldtime;
5
6 REGISTER_MUTATOR(midair, expr_evaluate(autocvar_g_midair));
7
8 .float midair_shieldtime;
9
10 MUTATOR_HOOKFUNCTION(midair, Damage_Calculate)
11 {
12         entity frag_attacker = M_ARGV(1, entity);
13         entity frag_target = M_ARGV(2, entity);
14
15         if(IS_PLAYER(frag_attacker))
16         if(IS_PLAYER(frag_target))
17         if(time < frag_target.midair_shieldtime)
18                 M_ARGV(4, float) = 0;
19 }
20
21 MUTATOR_HOOKFUNCTION(midair, PlayerPowerups)
22 {
23         entity player = M_ARGV(0, entity);
24
25         if(time >= game_starttime)
26         if(IS_ONGROUND(player))
27         {
28                 player.effects |= (EF_ADDITIVE | EF_FULLBRIGHT);
29                 player.midair_shieldtime = max(player.midair_shieldtime, time + autocvar_g_midair_shieldtime);
30         }
31 }
32
33 MUTATOR_HOOKFUNCTION(midair, PlayerSpawn)
34 {
35         entity player = M_ARGV(0, entity);
36
37         if(IS_BOT_CLIENT(player))
38                 player.bot_moveskill = 0; // disable bunnyhopping
39 }
40
41 MUTATOR_HOOKFUNCTION(midair, BuildMutatorsString)
42 {
43         M_ARGV(0, string) = strcat(M_ARGV(0, string), ":midair");
44 }
45
46 MUTATOR_HOOKFUNCTION(midair, BuildMutatorsPrettyString)
47 {
48         M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Midair");
49 }