Xonotic
sv_globalforces.qc File Reference
#include "sv_globalforces.qh"
+ Include dependency graph for sv_globalforces.qc:

Go to the source code of this file.

Functions

 AUTOCVAR (g_globalforces, float, false, "Global forces: knockback affects everyone")
 
 AUTOCVAR (g_globalforces_noself, bool, true, "Global forces: ignore self damage")
 
 AUTOCVAR (g_globalforces_self, float, 1, "Global forces: knockback self scale")
 
 AUTOCVAR (g_globalforces_range, float, 1000, "Global forces: max range of effect")
 
 MUTATOR_HOOKFUNCTION (mutator_globalforces, BuildMutatorsString)
 
 MUTATOR_HOOKFUNCTION (mutator_globalforces, BuildMutatorsPrettyString)
 
 MUTATOR_HOOKFUNCTION (mutator_globalforces, PlayerDamage_SplitHealthArmor)
 
 REGISTER_MUTATOR (mutator_globalforces, autocvar_g_globalforces)
 

Function Documentation

◆ AUTOCVAR() [1/4]

AUTOCVAR ( g_globalforces  ,
float  ,
false  ,
"Global forces: knockback affects everyone"   
)

◆ AUTOCVAR() [2/4]

AUTOCVAR ( g_globalforces_noself  ,
bool  ,
true  ,
"Global forces: ignore self damage"   
)

◆ AUTOCVAR() [3/4]

AUTOCVAR ( g_globalforces_self  ,
float  ,
,
"Global forces: knockback self scale  
)

◆ AUTOCVAR() [4/4]

AUTOCVAR ( g_globalforces_range  ,
float  ,
1000  ,
"Global forces: max range of effect"   
)

◆ MUTATOR_HOOKFUNCTION() [1/3]

MUTATOR_HOOKFUNCTION ( mutator_globalforces  ,
BuildMutatorsString   
)

Definition at line 9 of file sv_globalforces.qc.

References M_ARGV, and strcat().

9  {
10  M_ARGV(0, string) = strcat(M_ARGV(0, string), ":GlobalForces");
11 }
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"))
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [2/3]

MUTATOR_HOOKFUNCTION ( mutator_globalforces  ,
BuildMutatorsPrettyString   
)

Definition at line 13 of file sv_globalforces.qc.

References M_ARGV, and strcat().

13  {
14  M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Global forces");
15 }
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"))
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [3/3]

MUTATOR_HOOKFUNCTION ( mutator_globalforces  ,
PlayerDamage_SplitHealthArmor   
)

Definition at line 17 of file sv_globalforces.qc.

References autocvar_g_balance_damagepush_speedfactor, damage_explosion_calcpush(), entity(), FOREACH_CLIENT, IS_PLAYER, M_ARGV, vdist, and vector().

17  {
18  entity frag_attacker = M_ARGV(1, entity);
19  entity frag_target = M_ARGV(2, entity);
20  if (autocvar_g_globalforces_noself && frag_target == frag_attacker) return;
21  vector damage_force = M_ARGV(3, vector) * autocvar_g_globalforces;
22  FOREACH_CLIENT(IS_PLAYER(it) && it != frag_target, {
23  if (autocvar_g_globalforces_range) {
24  if (vdist(it.origin - frag_target.origin, >, autocvar_g_globalforces_range)) {
25  continue;
26  }
27  }
28  float f = (it == frag_attacker) ? autocvar_g_globalforces_self : 1;
29  it.velocity += damage_explosion_calcpush(f * it.damageforcescale * damage_force, it.velocity, autocvar_g_balance_damagepush_speedfactor);
30  });
31 }
entity() spawn
vector damage_explosion_calcpush(vector explosion_f, vector target_v, float speedfactor)
Definition: calculations.qc:45
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
#define M_ARGV(x, type)
Definition: events.qh:17
float autocvar_g_balance_damagepush_speedfactor
Definition: damage.qh:18
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition: vector.qh:8
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( mutator_globalforces  ,
autocvar_g_globalforces   
)