Xonotic
sv_midair.qc
Go to the documentation of this file.
1 #include "sv_midair.qh"
2 
5 
7 
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 }
string autocvar_g_midair
Definition: sv_midair.qc:3
MUTATOR_HOOKFUNCTION(midair, Damage_Calculate)
Definition: sv_midair.qc:10
float autocvar_g_midair_shieldtime
Definition: sv_midair.qc:4
entity() spawn
#define IS_ONGROUND(s)
Definition: movetypes.qh:16
const float EF_ADDITIVE
Definition: csprogsdefs.qc:300
const float EF_FULLBRIGHT
Definition: csprogsdefs.qc:303
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
float midair_shieldtime
Definition: sv_midair.qc:8
#define M_ARGV(x, type)
Definition: events.qh:17
#define IS_BOT_CLIENT(v)
want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
Definition: utils.qh:15
REGISTER_MUTATOR(midair, expr_evaluate(autocvar_g_midair))
float time
Definition: csprogsdefs.qc:16
#define IS_PLAYER(v)
Definition: utils.qh:9
ERASEABLE bool expr_evaluate(string s)
Evaluate an expression of the form: [+ | -]? [var[op]val | [op]var | val | var] ...
Definition: cvar.qh:48