]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/status_effects/status_effect/powerups.qc
Merge branch 'master' into terencehill/lms_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / status_effects / status_effect / powerups.qc
1 #include "powerups.qh"
2
3 #ifdef CSQC
4 METHOD(Strength, m_active, bool(StatusEffects this, entity actor))
5 {
6     if(autocvar__hud_configure)
7         return true;
8     return SUPER(Strength).m_active(this, actor);
9 }
10 METHOD(Strength, m_tick, void(StatusEffects this, entity actor))
11 {
12     if(this.m_hidden)
13         return;
14
15     float currentTime = (autocvar__hud_configure) ? 15 : bound(0, actor.statuseffect_time[this.m_id] - time, 99);
16     addPowerupItem(this.m_name, this.m_icon, autocvar_hud_progressbar_strength_color, currentTime, this.m_lifetime, (actor.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_PERSISTENT));
17 }
18
19 METHOD(Superweapons, m_active, bool(StatusEffects this, entity actor))
20 {
21     if(autocvar__hud_configure)
22         return true;
23     return SUPER(Superweapons).m_active(this, actor);
24 }
25 METHOD(Superweapons, m_tick, void(StatusEffects this, entity actor))
26 {
27     if(this.m_hidden)
28         return;
29
30     int allItems = STAT(ITEMS);
31
32     // Prevent stuff to show up on mismatch that will be fixed next frame
33     if(!(allItems & IT_SUPERWEAPON) && !autocvar__hud_configure)
34         return;
35
36     if(allItems & IT_UNLIMITED_SUPERWEAPONS)
37         return;
38
39     float currentTime = (autocvar__hud_configure) ? 13 : bound(0, actor.statuseffect_time[this.m_id] - time, 99);
40     addPowerupItem(this.m_name, this.m_icon, autocvar_hud_progressbar_superweapons_color, currentTime, this.m_lifetime, (actor.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_PERSISTENT));
41 }
42
43 METHOD(Shield, m_active, bool(StatusEffects this, entity actor))
44 {
45     if(autocvar__hud_configure)
46         return true;
47     return SUPER(Shield).m_active(this, actor);
48 }
49 METHOD(Shield, m_tick, void(StatusEffects this, entity actor))
50 {
51     if(this.m_hidden)
52         return;
53
54     float currentTime = (autocvar__hud_configure) ? 27 : bound(0, actor.statuseffect_time[this.m_id] - time, 99);
55     addPowerupItem(this.m_name, this.m_icon, autocvar_hud_progressbar_shield_color, currentTime, this.m_lifetime, (actor.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_PERSISTENT));
56 }
57 #endif