]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/status_effects/status_effects.qc
5775032440a83c7144b73dccdb80d9ba9daa9966
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / status_effects / status_effects.qc
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         if (!actor || eff_time <= time)
31                 return;
32
33         this.m_apply(this, actor, eff_time, eff_flags);
34 }
35
36 void StatusEffects_copy(StatusEffects this, entity store, float time_offset)
37 {
38         if(!this || !store)
39                 return;
40         FOREACH(StatusEffect, true,
41         {
42                 if(time_offset)
43                         store.statuseffect_time[it.m_id] = time + this.statuseffect_time[it.m_id] - time_offset;
44                 else
45                         store.statuseffect_time[it.m_id] = this.statuseffect_time[it.m_id];
46                 store.statuseffect_flags[it.m_id] = this.statuseffect_flags[it.m_id];
47         });
48 }
49
50 void StatusEffects_remove(StatusEffects this, entity actor, int removal_type)
51 {
52         this.m_remove(this, actor, removal_type);
53 }
54
55 void StatusEffects_removeall(entity actor, int removal_type)
56 {
57         if(!actor.statuseffects)
58                 return;
59         FOREACH(StatusEffect, true,
60         {
61                 it.m_remove(it, actor, removal_type);
62         });
63 }
64 #endif