Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
SwapperBuff Class Reference
Inheritance diagram for SwapperBuff:
Collaboration diagram for SwapperBuff:

Public Member Functions

 ATTRIB (StatusEffect, m_icon, string)
 ATTRIB (StatusEffect, m_name, string)
virtual void describe ()
virtual void m_active ()
virtual void m_apply ()
virtual void m_persistent ()
 Sets the persistent flag and updates client side if returning true.
virtual void m_remove ()
virtual void m_tick ()
virtual void m_time ()

Public Attributes

vector m_color = '0.63 0.36 1'
bool m_hidden = false
 Whether the effect is displayed in the HUD.
int m_id = 0
int m_itemid = IT_BUFF
float m_lifetime = 60
string m_name = _("Swapper")
int m_skin = 17
Sound m_sound = SND_Null
Sound m_sound_rm = SND_Null
string m_sprite = ""
string netname = "swapper"
int statuseffect_flags [REGISTRY_MAX(StatusEffects)]
float statuseffect_time [REGISTRY_MAX(StatusEffects)]
 Stores times of status effects, the id being the index.

Detailed Description

Definition at line 9 of file swapper.qh.

Member Function Documentation

◆ ATTRIB() [1/2]

StatusEffect::ATTRIB ( StatusEffect ,
m_icon ,
string  )
inherited

References ATTRIB().

◆ ATTRIB() [2/2]

StatusEffect::ATTRIB ( StatusEffect ,
m_name ,
string  )
inherited

References ATTRIB(), and m_name.

Referenced by ATTRIB(), and ATTRIB().

◆ describe()

virtual void Buff::describe ( )
inlinevirtualinherited

Definition at line 29 of file buffs.qh.

30 {
31 TC(Buff, this);
32 return SUPER(Buff).describe(this);
33 }
#define TC(T, sym)
Definition _all.inc:82
#define SUPER(cname)
Definition oo.qh:231

References describe(), SUPER, and TC.

Referenced by describe().

◆ m_active()

void StatusEffect::m_active ( )
virtualinherited

Definition at line 3 of file cl_status_effects.qc.

4{
5 // TODO: allow per-entity status effects on the client side
6 actor = g_statuseffects;
7
8 if(!actor) return false;
9 TC(StatusEffect, this);
10 return (actor.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE);
11}
@ STATUSEFFECT_FLAG_ACTIVE
Definition all.qh:22
StatusEffect g_statuseffects

References entity(), g_statuseffects, m_active(), STATUSEFFECT_FLAG_ACTIVE, and TC.

Referenced by m_active().

◆ m_apply()

void StatusEffect::m_apply ( )
virtualinherited

Definition at line 29 of file sv_status_effects.qc.

30{
31 if(!actor.statuseffects)
32 StatusEffects_new(actor);
33
34 eff_flags |= STATUSEFFECT_FLAG_ACTIVE; // automatically enable active flag if applied (TODO?)
35 actor.statuseffects.statuseffect_time[this.m_id] = eff_time; // TODO: add onto the existing time rather than replacing it?
36 actor.statuseffects.statuseffect_flags[this.m_id] = eff_flags;
38}
int m_id
Definition all.qh:34
void StatusEffects_new(entity this)
void StatusEffects_update(entity e)

References entity(), m_apply(), m_id, STATUSEFFECT_FLAG_ACTIVE, StatusEffects_new(), and StatusEffects_update().

Referenced by m_apply().

◆ m_persistent()

virtual void StatusEffect::m_persistent ( )
inlinevirtualinherited

Sets the persistent flag and updates client side if returning true.

Definition at line 55 of file all.qh.

55{ return false; };

References entity(), and m_persistent().

Referenced by m_persistent().

◆ m_remove()

void StatusEffect::m_remove ( )
virtualinherited

Definition at line 40 of file sv_status_effects.qc.

41{
42 StatusEffect data = actor.statuseffects;
43 if(!data)
44 return;
45 // NOTE: persistent effects do not make a sound on removal, this is intended as a workaround for #2620
46 if(removal_type == STATUSEFFECT_REMOVE_NORMAL && !(data.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_PERSISTENT) && this.m_active(this, actor))
48 data.statuseffect_time[this.m_id] = 0;
49 data.statuseffect_flags[this.m_id] = 0;
51}
int statuseffect_flags[REGISTRY_MAX(StatusEffects)]
Definition all.qh:49
float statuseffect_time[REGISTRY_MAX(StatusEffects)]
Stores times of status effects, the id being the index.
Definition all.qh:48
Sound m_sound_rm
Definition all.qh:44
@ STATUSEFFECT_REMOVE_NORMAL
Effect is being removed by a function, calls regular removal mechanics.
Definition all.qh:28
@ STATUSEFFECT_FLAG_PERSISTENT
Effect is currently being granted passively.
Definition all.qh:23
const int CH_TRIGGER
Definition sound.qh:12
const float VOL_BASE
Definition sound.qh:36
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52

References ATTEN_NORM, CH_TRIGGER, entity(), m_id, m_remove(), m_sound_rm, sound, STATUSEFFECT_FLAG_PERSISTENT, statuseffect_flags, STATUSEFFECT_REMOVE_NORMAL, statuseffect_time, StatusEffects_update(), and VOL_BASE.

Referenced by m_remove().

◆ m_tick()

void StatusEffect::m_tick ( )
virtualinherited

Definition at line 13 of file cl_status_effects.qc.

14{
16 return;
17
18 float currentTime = bound(0, actor.statuseffect_time[this.m_id] - time, 99);
19 addPowerupItem(this.m_name, this.m_icon, this.m_color, currentTime, this.m_lifetime, (actor.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_PERSISTENT));
20}
bool m_hidden
Whether the effect is displayed in the HUD.
Definition all.qh:39
float m_lifetime
Lifetime scale for HUD progress bars.
Definition all.qh:41
vector m_color
Definition all.qh:37
void addPowerupItem(string name, string icon, vector color, float currentTime, float lifeTime, bool isInfinite)
Definition powerups.qc:38
string m_name
Definition scores.qh:142
float time
bool autocvar__hud_configure
Definition hud_config.qh:3
float bound(float min, float value, float max)

References addPowerupItem(), autocvar__hud_configure, bound(), entity(), m_color, m_hidden, m_lifetime, m_name, m_tick(), STATUSEFFECT_FLAG_PERSISTENT, and time.

Referenced by m_tick().

◆ m_time()

virtual void Buff::m_time ( )
inlinevirtualinherited

Definition at line 45 of file buffs.qh.

46 {
47 return cvar(strcat("g_buffs_", this.netname, "_time"));
48 }
string netname
Definition buffs.qh:21
float cvar(string name)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

References cvar(), m_time(), netname, and strcat().

Referenced by m_time().

Member Data Documentation

◆ m_color

vector SwapperBuff::m_color = '0.63 0.36 1'

Definition at line 18 of file swapper.qh.

◆ m_hidden

bool StatusEffect::m_hidden = false
inherited

Whether the effect is displayed in the HUD.

Definition at line 39 of file all.qh.

Referenced by m_tick().

◆ m_id

int StatusEffect::m_id = 0
inherited

Definition at line 34 of file all.qh.

Referenced by m_apply(), m_remove(), and NET_HANDLE().

◆ m_itemid

int Buff::m_itemid = IT_BUFF
inherited

Definition at line 19 of file buffs.qh.

◆ m_lifetime

float Buff::m_lifetime = 60
inherited

Definition at line 44 of file buffs.qh.

◆ m_name

string SwapperBuff::m_name = _("Swapper")

Definition at line 10 of file swapper.qh.

◆ m_skin

int SwapperBuff::m_skin = 17

Definition at line 16 of file swapper.qh.

◆ m_sound

Sound StatusEffect::m_sound = SND_Null
inherited

Definition at line 43 of file all.qh.

◆ m_sound_rm

Sound StatusEffect::m_sound_rm = SND_Null
inherited

Definition at line 44 of file all.qh.

Referenced by m_remove().

◆ m_sprite

string Buff::m_sprite = ""
inherited

Definition at line 27 of file buffs.qh.

◆ netname

string SwapperBuff::netname = "swapper"

Definition at line 11 of file swapper.qh.

◆ statuseffect_flags

int StatusEffect::statuseffect_flags[REGISTRY_MAX(StatusEffects)]
inherited

Definition at line 49 of file all.qh.

Referenced by m_remove(), and StatusEffects_Write().

◆ statuseffect_time

float StatusEffect::statuseffect_time[REGISTRY_MAX(StatusEffects)]
inherited

Stores times of status effects, the id being the index.

Definition at line 48 of file all.qh.

Referenced by m_remove(), and StatusEffects_Write().


The documentation for this class was generated from the following file: