Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_globalforces.qc File Reference
#include "sv_globalforces.qh"
Include dependency graph for sv_globalforces.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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

Function Documentation

◆ AUTOCVAR() [1/4]

AUTOCVAR ( g_globalforces ,
float ,
false ,
"enable global forces,
so that knockback affects everyone"  )

◆ AUTOCVAR() [2/4]

AUTOCVAR ( g_globalforces_noself ,
bool ,
true ,
"ignore self damage"  )

◆ AUTOCVAR() [3/4]

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

◆ AUTOCVAR() [4/4]

AUTOCVAR ( g_globalforces_self ,
float ,
1 ,
"global forces knockback self scale"  )

◆ MUTATOR_HOOKFUNCTION() [1/3]

MUTATOR_HOOKFUNCTION ( mutator_globalforces ,
BuildMutatorsPrettyString  )

Definition at line 13 of file sv_globalforces.qc.

13 {
14 M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Global forces");
15}
#define M_ARGV(x, type)
Definition events.qh:17
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

References M_ARGV, and strcat().

◆ MUTATOR_HOOKFUNCTION() [2/3]

MUTATOR_HOOKFUNCTION ( mutator_globalforces ,
BuildMutatorsString  )

Definition at line 9 of file sv_globalforces.qc.

9 {
10 M_ARGV(0, string) = strcat(M_ARGV(0, string), ":GlobalForces");
11}

References M_ARGV, and strcat().

◆ MUTATOR_HOOKFUNCTION() [3/3]

MUTATOR_HOOKFUNCTION ( mutator_globalforces ,
PlayerDamage_SplitHealthArmor  )

Definition at line 17 of file sv_globalforces.qc.

17 {
18 entity frag_attacker = M_ARGV(1, entity);
20 if (autocvar_g_globalforces_noself && frag_target == frag_attacker) return;
21 vector damage_force = M_ARGV(3, vector) * autocvar_g_globalforces;
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}
vector damage_explosion_calcpush(vector explosion_f, vector target_v, float speedfactor)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define IS_PLAYER(s)
Definition player.qh:243
float autocvar_g_balance_damagepush_speedfactor
Definition damage.qh:18
vector
Definition self.qh:92
entity frag_target
Definition sv_ctf.qc:2321
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8

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

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( mutator_globalforces ,
autocvar_g_globalforces  )