Xonotic
status_effects.qc
Go to the documentation of this file.
1 #include "status_effects.qh"
2 
3 #ifdef GAMEQC
4 bool StatusEffects_active(StatusEffects this, entity actor)
5 {
6  return this.m_active(this, actor);
7 }
8 
9 void StatusEffects_tick(entity actor)
10 {
11  FOREACH(StatusEffect, it.m_active(it, actor),
12  {
13  it.m_tick(it, actor);
14  });
15 }
16 
17 float StatusEffects_gettime(StatusEffects this, entity actor)
18 {
19  entity store = actor;
20 #ifdef SVQC
21  store = actor.statuseffects;
22 #endif
23  if(!store) return 0;
24  return store.statuseffect_time[this.m_id];
25 }
26 #endif
27 #ifdef SVQC
28 void StatusEffects_apply(StatusEffects this, entity actor, float eff_time, int eff_flags)
29 {
30  this.m_apply(this, actor, eff_time, eff_flags);
31 }
32 
33 void StatusEffects_copy(StatusEffects this, entity store, float time_offset)
34 {
35  if(!this || !store)
36  return;
37  FOREACH(StatusEffect, true,
38  {
39  if(time_offset)
40  store.statuseffect_time[it.m_id] = time + this.statuseffect_time[it.m_id] - time_offset;
41  else
42  store.statuseffect_time[it.m_id] = this.statuseffect_time[it.m_id];
43  store.statuseffect_flags[it.m_id] = this.statuseffect_flags[it.m_id];
44  });
45 }
46 
47 void StatusEffects_remove(StatusEffects this, entity actor, int removal_type)
48 {
49  this.m_remove(this, actor, removal_type);
50 }
51 
52 void StatusEffects_removeall(entity actor, int removal_type)
53 {
54  if(!actor.statuseffects)
55  return;
56  FOREACH(StatusEffect, true,
57  {
58  it.m_remove(it, actor, removal_type);
59  });
60 }
61 #endif
entity() spawn
int m_id
Definition: effect.qh:19
float time
Definition: csprogsdefs.qc:16
#define FOREACH(list, cond, body)
Definition: iter.qh:19