]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/status_effects/cl_status_effects.qc
Experimental status effects system: general backend for buffs and debuffs networked...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / status_effects / cl_status_effects.qc
1 #include "cl_status_effects.qh"
2
3 METHOD(StatusEffects, m_active, bool(StatusEffects this, entity actor))
4 {
5         if(!actor) return false;
6         TC(StatusEffects, this);
7         return (actor.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE);
8 }
9
10 METHOD(StatusEffects, m_tick, void(StatusEffects this, entity actor))
11 {
12         if(this.m_hidden || autocvar__hud_configure)
13                 return;
14
15         float currentTime = bound(0, actor.statuseffect_time[this.m_id] - time, 99);
16         addPowerupItem(this.m_name, this.m_icon, this.m_color, currentTime, this.m_lifetime, (actor.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_PERSISTENT));
17 }
18
19 MUTATOR_HOOKFUNCTION(status_effects, HUD_Powerups_add)
20 {
21         if(!g_statuseffects && !autocvar__hud_configure) return;
22
23         // NOTE: the passed entity may be null here if we're in configure mode
24         StatusEffects_tick(g_statuseffects);
25 }