4 #include <common/sounds/all.qh>
7 REGISTRY(StatusEffect, 32)
8 REGISTER_REGISTRY(StatusEffect)
9 #define REGISTER_STATUSEFFECT(id, inst) REGISTER(StatusEffect, STATUSEFFECT, id, m_id, inst)
11 REGISTRY_SORT(StatusEffect)
12 REGISTRY_CHECK(StatusEffect)
14 REGISTRY_DEFINE_GET(StatusEffect, NULL)
15 STATIC_INIT(StatusEffect) { FOREACH(StatusEffect, true, it.m_id = i); }
19 STATUSEFFECT_FLAG_ACTIVE = BIT(0),
20 STATUSEFFECT_FLAG_PERSISTENT = BIT(1) ///< Effect is currently being granted passively.
25 STATUSEFFECT_REMOVE_NORMAL, ///< Effect is being removed by a function, calls regular removal mechanics.
26 STATUSEFFECT_REMOVE_TIMEOUT,
27 STATUSEFFECT_REMOVE_CLEAR ///< Effect is being forcibly removed without calling any additional mechanics.
30 CLASS(StatusEffects, Object)
31 ATTRIB(StatusEffects, m_id, int, 0);
32 ATTRIB(StatusEffects, m_name, string);
33 ATTRIB(StatusEffects, m_icon, string);
34 ATTRIB(StatusEffects, m_color, vector, '1 1 1');
35 /** Whether the effect is displayed in the HUD */
36 ATTRIB(StatusEffects, m_hidden, bool, false);
37 /** Lifetime scale for HUD progress bars */
38 ATTRIB(StatusEffects, m_lifetime, float, 30);
40 ATTRIB(StatusEffects, m_sound, Sound, SND_Null);
41 ATTRIB(StatusEffects, m_sound_rm, Sound, SND_Null);
42 METHOD(StatusEffects, m_tick, void(StatusEffects this, entity actor));
43 METHOD(StatusEffects, m_active, bool(StatusEffects this, entity actor));
44 /** Stores times of status effects, the id being the index */
45 ATTRIBARRAY(StatusEffects, statuseffect_time, float, REGISTRY_MAX(StatusEffect));
46 ATTRIBARRAY(StatusEffects, statuseffect_flags, int, REGISTRY_MAX(StatusEffect));
49 METHOD(StatusEffects, m_apply, void(StatusEffects this, entity actor, float eff_time, int eff_flags));
50 METHOD(StatusEffects, m_remove, void(StatusEffects this, entity actor, int removal_type));
51 /** Sets the persistent flag and updates client side if returning true */
52 METHOD(StatusEffects, m_persistent, bool(StatusEffects this, entity actor)) { return false; };
54 METHOD(StatusEffects, display, void(StatusEffects this, void(string name, string icon) returns))
56 TC(StatusEffects, this);
57 returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon) : string_null);
59 ENDCLASS(StatusEffects)