Xonotic
cl_status_effects.qc
Go to the documentation of this file.
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 }
bool autocvar__hud_configure
Definition: hud_config.qh:3
entity() spawn
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
void addPowerupItem(string name, string icon, vector color, float currentTime, float lifeTime, bool isInfinite)
Definition: powerups.qc:38
MUTATOR_HOOKFUNCTION(status_effects, HUD_Powerups_add)
Effect is currently being granted passively.
Definition: all.qh:20
#define TC(T, sym)
Definition: _all.inc:82
float time
Definition: csprogsdefs.qc:16
string m_name
Definition: scores.qh:135