Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
strength.qc
Go to the documentation of this file.
1#include "strength.qh"
2
3#ifdef SVQC
4METHOD(StrengthStatusEffect, m_remove, void(StatusEffect this, entity actor, int removal_type))
5{
6 bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
7 if(removal_type == STATUSEFFECT_REMOVE_TIMEOUT && wasactive && IS_PLAYER(actor))
8 {
9 //Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERDOWN_STRENGTH, actor.netname);
10 Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERDOWN_STRENGTH);
11 }
12 if(wasactive)
13 stopsound(actor, CH_TRIGGER_SINGLE); // get rid of the pickup sound
14 actor.effects &= ~(EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
15 SUPER(StrengthStatusEffect).m_remove(this, actor, removal_type);
16}
17METHOD(StrengthStatusEffect, m_apply, void(StatusEffect this, entity actor, float eff_time, float eff_flags))
18{
19 bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
20 if(!wasactive && IS_PLAYER(actor))
21 {
22 if(!g_cts)
23 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_STRENGTH, actor.netname);
24 Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_STRENGTH);
25 }
26 SUPER(StrengthStatusEffect).m_apply(this, actor, eff_time, eff_flags);
27}
28METHOD(StrengthStatusEffect, m_tick, void(StatusEffect this, entity actor))
29{
30 play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF);
31 actor.effects |= (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
32 SUPER(StrengthStatusEffect).m_tick(this, actor);
33}
34#endif // SVQC
35#ifdef CSQC
36METHOD(StrengthStatusEffect, m_active, bool(StatusEffect this, entity actor))
37{
39 return true;
40 return SUPER(StrengthStatusEffect).m_active(this, actor);
41}
42METHOD(StrengthStatusEffect, m_tick, void(StatusEffect this, entity actor))
43{
44 if(this.m_hidden)
45 return;
46
47 float currentTime = (autocvar__hud_configure) ? 15 : bound(0, actor.statuseffect_time[this.m_id] - time, 99);
48 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));
49}
50#endif // CSQC
51#ifdef MENUQC
52METHOD(StrengthItem, describe, string(StrengthItem this))
53{
54 TC(StrengthItem, this);
56 PAR(_("The %s powerup greatly increases the damage you deal, until the powerup expires. "
57 "It also increases the knockback that your attacks deal."), COLORED_NAME(this));
58 PAR(_("The damage and knockback you deal to yourself also increases but by a smaller amount."));
59 PAR(_("The %s is one of the most sought after items on a map due to its ability to allow you to easily dominate a map, so it's often highly contested when it spawns in."), COLORED_NAME(this));
60 PAR(_("Since it is a powerup, it will drop if you die while holding it.")); // shared message
61 return PAGE_TEXT;
62}
63#endif // MENUQC
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_strength_color
Definition powerups.qh:13
#define COLORED_NAME(this)
Definition color.qh:195
#define IS_PLAYER(s)
Definition player.qh:243
string m_name
Definition scores.qh:142
const float EF_ADDITIVE
const float EF_FULLBRIGHT
float time
const float EF_BLUE
#define g_cts
Definition cts.qh:36
int m_id
Definition effect.qh:19
bool m_hidden
Definition guide.qh:29
bool autocvar__hud_configure
Definition hud_config.qh:3
#define TC(T, sym)
Definition _all.inc:82
float bound(float min, float value, float max)
@ STATUSEFFECT_REMOVE_TIMEOUT
Definition all.qh:29
@ STATUSEFFECT_FLAG_PERSISTENT
Effect is currently being granted passively.
Definition all.qh:23
@ STATUSEFFECT_FLAG_ACTIVE
Definition all.qh:22
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1573
#define SUPER(cname)
Definition oo.qh:231
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define NULL
Definition post.qh:14
entity this
Definition self.qh:72
void play_countdown(entity this, float finished, Sound samp)
Definition client.qc:1526
const int CH_TRIGGER_SINGLE
Definition sound.qh:13
void stopsound(entity e, int chan)
Definition all.qc:109
float StatusEffects_gettime(StatusEffect this, entity actor)
#define PAGE_TEXT
Definition string.qh:643
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:649
#define PAGE_TEXT_INIT()
Definition string.qh:642