Xonotic
superweapons.qc
Go to the documentation of this file.
1 #include "superweapons.qh"
2 
3 #ifdef SVQC
4 METHOD(Superweapons, m_persistent, bool(StatusEffects this, entity actor))
5 {
6  return (actor.items & IT_UNLIMITED_SUPERWEAPONS);
7 }
8 #endif
9 
10 #ifdef CSQC
11 METHOD(Superweapons, m_active, bool(StatusEffects this, entity actor))
12 {
14  return true;
15  return SUPER(Superweapons).m_active(this, actor);
16 }
17 METHOD(Superweapons, m_tick, void(StatusEffects this, entity actor))
18 {
19  if(this.m_hidden)
20  return;
21 
22  int allItems = STAT(ITEMS);
23 
24  // Prevent stuff to show up on mismatch that will be fixed next frame
25  if(!(allItems & IT_SUPERWEAPON) && !autocvar__hud_configure)
26  return;
27 
28  if(allItems & IT_UNLIMITED_SUPERWEAPONS)
29  return;
30 
31  float currentTime = (autocvar__hud_configure) ? 13 : bound(0, actor.statuseffect_time[this.m_id] - time, 99);
32  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));
33 }
34 #endif
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
#define SUPER(cname)
Definition: oo.qh:219
Effect is currently being granted passively.
Definition: all.qh:20
float time
Definition: csprogsdefs.qc:16
vector autocvar_hud_progressbar_superweapons_color
Definition: powerups.qh:14
string m_name
Definition: scores.qh:135