Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
disability.qc
Go to the documentation of this file.
1#include "disability.qh"
2
3#ifdef SVQC
5{
6 if (frag_target != frag_attacker)
8}
9
10MUTATOR_HOOKFUNCTION(buffs, PlayerPhysics_UpdateStats)
11{
12 entity player = M_ARGV(0, entity);
13 // these automatically reset, no need to worry
14
15 if (StatusEffects_active(STATUSEFFECT_Stunned, player))
16 STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_buffs_disability_speed;
17}
18
19MUTATOR_HOOKFUNCTION(buffs, MonsterMove)
20{
21 entity mon = M_ARGV(0, entity);
22
23 if (StatusEffects_active(STATUSEFFECT_Stunned, mon))
24 {
25 M_ARGV(1, float) *= autocvar_g_buffs_disability_speed; // run speed
26 M_ARGV(2, float) *= autocvar_g_buffs_disability_speed; // walk speed
27 }
28}
29
30MUTATOR_HOOKFUNCTION(buffs, WeaponRateFactor)
31{
32 entity player = M_ARGV(1, entity);
33
34 if (StatusEffects_active(STATUSEFFECT_Stunned, player))
36}
37MUTATOR_HOOKFUNCTION(buffs, WeaponSpeedFactor)
38{
39 entity player = M_ARGV(1, entity);
40
41 if (StatusEffects_active(STATUSEFFECT_Stunned, player))
43}
44#endif // SVQC
45#ifdef MENUQC
46METHOD(DisabilityBuff, describe, string(DisabilityBuff this))
47{
48 TC(DisabilityBuff, this);
50 PAR(_("The %s buff causes your enemies and monsters to slow down for a few seconds when you attack them, while the buff is active."), COLORED_NAME(this));
51 PAR(_("This is particularly useful against speedy players, especially in %s."), COLORED_NAME(MAPINFO_TYPE_CTF));
52 return PAGE_TEXT;
53}
54#endif // MENUQC
#define MUTATOR_HOOKFUNCTION(...)
Definition base.qh:335
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define COLORED_NAME(this)
Definition color.qh:195
#define M_ARGV(x, type)
Definition events.qh:17
float time
void buff_Disability_ApplyStunned(entity frag_target, entity frag_attacker)
Definition disability.qc:4
float autocvar_g_buffs_disability_slowtime
Definition disability.qh:6
float autocvar_g_buffs_disability_attack_time_multiplier
Definition disability.qh:8
float autocvar_g_buffs_disability_weaponspeed
Definition disability.qh:9
float autocvar_g_buffs_disability_speed
Definition disability.qh:7
#define TC(T, sym)
Definition _all.inc:82
#define STAT(...)
Definition stats.qh:82
#define METHOD(cname, name, prototype)
Definition oo.qh:269
bool StatusEffects_active(StatusEffect this, entity actor)
void StatusEffects_apply(StatusEffect this, entity actor, float eff_time, int eff_flags)
#define PAGE_TEXT
Definition string.qh:643
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:649
#define PAGE_TEXT_INIT()
Definition string.qh:642
entity frag_target
Definition sv_ctf.qc:2321