Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
status_effects.qc
Go to the documentation of this file.
1#include "status_effects.qh"
2
3#ifdef GAMEQC
5{
6 return this.m_active(this, actor);
7}
8
10{
11 FOREACH(StatusEffects, it.m_active(it, actor),
12 {
13 it.m_tick(it, actor);
14 });
15}
16
18{
19 entity store = actor;
20#ifdef SVQC
21 store = actor.statuseffects;
22#endif
23 if(!store) return 0;
24 float eff_time = store.statuseffect_time[this.m_id];
25 // if effect end time has passed and m_tick hasn't removed the effect yet
26 // return current time since the effect is actually still active in this frame
27 return (eff_time < time ? time : eff_time);
28}
29#endif
30#ifdef SVQC
31void StatusEffects_apply(StatusEffect this, entity actor, float eff_time, int eff_flags)
32{
33 if (!actor || eff_time <= time)
34 return;
35
36 this.m_apply(this, actor, eff_time, eff_flags);
37}
38
39void StatusEffects_copy(StatusEffect this, entity store, float time_offset)
40{
41 if(!this || !store)
42 return;
43 FOREACH(StatusEffects, true,
44 {
45 if(time_offset)
46 store.statuseffect_time[it.m_id] = time + this.statuseffect_time[it.m_id] - time_offset;
47 else
48 store.statuseffect_time[it.m_id] = this.statuseffect_time[it.m_id];
49 store.statuseffect_flags[it.m_id] = this.statuseffect_flags[it.m_id];
50 });
51}
52
53void StatusEffects_remove(StatusEffect this, entity actor, int removal_type)
54{
55 this.m_remove(this, actor, removal_type);
56}
57
58void StatusEffects_removeall(entity actor, int removal_type)
59{
60 if(!actor.statuseffects)
61 return;
62 FOREACH(StatusEffects, true,
63 {
64 it.m_remove(it, actor, removal_type);
65 });
66}
67#endif
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float time
int m_id
Definition effect.qh:19
#define FOREACH(list, cond, body)
Definition iter.qh:19
void StatusEffects_removeall(entity actor, int removal_type)
void StatusEffects_remove(StatusEffect this, entity actor, int removal_type)
void StatusEffects_copy(StatusEffect this, entity store, float time_offset)
float StatusEffects_gettime(StatusEffect this, entity actor)
bool StatusEffects_active(StatusEffect this, entity actor)
void StatusEffects_apply(StatusEffect this, entity actor, float eff_time, int eff_flags)
void StatusEffects_tick(entity actor)