Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
superweapons.qc
Go to the documentation of this file.
1#include "superweapons.qh"
2
3#ifdef SVQC
4METHOD(Superweapon, m_persistent, bool(StatusEffect this, entity actor))
5{
6 return (actor.items & IT_UNLIMITED_SUPERWEAPONS);
7}
8#endif
9
10#ifdef CSQC
11METHOD(Superweapon, m_active, bool(StatusEffect this, entity actor))
12{
14 return true;
15 return SUPER(Superweapon).m_active(this, actor);
16}
17METHOD(Superweapon, m_tick, void(StatusEffect 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
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void addPowerupItem(string name, string icon, vector color, float currentTime, float lifeTime, bool isInfinite)
Definition powerups.qc:38
vector autocvar_hud_progressbar_superweapons_color
Definition powerups.qh:14
const int IT_SUPERWEAPON
Definition item.qh:41
const int IT_UNLIMITED_SUPERWEAPONS
Definition item.qh:24
string m_name
Definition scores.qh:142
float time
int m_id
Definition effect.qh:19
bool m_hidden
Definition guide.qh:29
bool autocvar__hud_configure
Definition hud_config.qh:3
#define STAT(...)
Definition stats.qh:82
float bound(float min, float value, float max)
@ STATUSEFFECT_FLAG_PERSISTENT
Effect is currently being granted passively.
Definition all.qh:23
#define SUPER(cname)
Definition oo.qh:231
#define METHOD(cname, name, prototype)
Definition oo.qh:269
entity this
Definition self.qh:72