Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
invisibility.qc
Go to the documentation of this file.
1#include "invisibility.qh"
2
3#ifdef SVQC
4METHOD(InvisibilityStatusEffect, 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_INVISIBILITY, actor.netname);
10 Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
11 }
12 if(wasactive)
13 stopsound(actor, CH_TRIGGER_SINGLE); // get rid of the pickup sound
14 if(!actor.vehicle)
15 {
16 actor.alpha = default_player_alpha;
17 if(actor.exteriorweaponentity)
18 actor.exteriorweaponentity.alpha = default_weapon_alpha;
19 }
20 SUPER(InvisibilityStatusEffect).m_remove(this, actor, removal_type);
21}
22METHOD(InvisibilityStatusEffect, m_apply, void(StatusEffect this, entity actor, float eff_time, float eff_flags))
23{
24 bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE));
25 if(!wasactive && IS_PLAYER(actor))
26 {
27 if(!g_cts)
28 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_INVISIBILITY, actor.netname);
29 Send_Notification(NOTIF_ONE, actor, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
30 }
31 SUPER(InvisibilityStatusEffect).m_apply(this, actor, eff_time, eff_flags);
32}
33METHOD(InvisibilityStatusEffect, m_tick, void(StatusEffect this, entity actor))
34{
35 SUPER(InvisibilityStatusEffect).m_tick(this, actor);
36 if(!this.m_active(this, actor))
37 return;
38 play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF);
39 if(!actor.vehicle)
40 {
42 if(actor.exteriorweaponentity)
43 actor.exteriorweaponentity.alpha = autocvar_g_balance_powerup_invisibility_alpha;
44 }
45}
46#endif // SVQC
47#ifdef MENUQC
49
50METHOD(InvisibilityItem, describe, string(InvisibilityItem this))
51{
52 TC(InvisibilityItem, this);
54 PAR(_("The %s powerup increases your translucency while the powerup is active, making it more difficult for enemies to see you. "
55 "This powerup is often present in %s."), COLORED_NAME(this), COLORED_NAME(MUTATOR_mutator_instagib));
56 PAR(_("Since it is a powerup, it will drop if you die while holding it.")); // shared message
57 return PAGE_TEXT;
58}
59#endif // MENUQC
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define COLORED_NAME(this)
Definition color.qh:189
#define IS_PLAYER(s)
Definition player.qh:242
#define g_cts
Definition cts.qh:36
int m_id
Definition effect.qh:18
float autocvar_g_balance_powerup_invisibility_alpha
#define TC(T, sym)
Definition _all.inc:82
@ STATUSEFFECT_REMOVE_TIMEOUT
Definition all.qh:29
@ STATUSEFFECT_FLAG_ACTIVE
Definition all.qh:22
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1500
#define SUPER(cname)
Definition oo.qh:236
#define METHOD(cname, name, prototype)
Definition oo.qh:274
#define NULL
Definition post.qh:14
void play_countdown(entity this, float finished, Sound samp)
Definition client.qc:1533
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:651
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:657
#define PAGE_TEXT_INIT()
Definition string.qh:650
float default_weapon_alpha
Definition world.qh:73
float default_player_alpha
Definition world.qh:72