Xonotic
invisibility.qc
Go to the documentation of this file.
1 #include "invisibility.qh"
2 
3 #ifdef SVQC
4 METHOD(Invisibility, m_remove, void(StatusEffects 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(Invisibility).m_remove(this, actor, removal_type);
21 }
22 METHOD(Invisibility, m_apply, void(StatusEffects 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(Invisibility).m_apply(this, actor, eff_time, eff_flags);
32 }
33 METHOD(Invisibility, m_tick, void(StatusEffects this, entity actor))
34 {
35  play_countdown(actor, StatusEffects_gettime(this, actor), SND_POWEROFF);
36  if(!actor.vehicle)
37  {
38  actor.alpha = autocvar_g_balance_powerup_invisibility_alpha;
39  if(actor.exteriorweaponentity)
40  actor.exteriorweaponentity.alpha = autocvar_g_balance_powerup_invisibility_alpha;
41  }
42  SUPER(Invisibility).m_tick(this, actor);
43 }
44 #endif
void play_countdown(entity this, float finished, Sound samp)
Definition: client.qc:1447
entity() spawn
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
#define SUPER(cname)
Definition: oo.qh:219
int m_id
Definition: effect.qh:19
#define g_cts
Definition: cts.qh:36
#define NULL
Definition: post.qh:17
const int CH_TRIGGER_SINGLE
Definition: sound.qh:13
float default_player_alpha
Definition: world.qh:66
float default_weapon_alpha
Definition: world.qh:67
#define IS_PLAYER(v)
Definition: utils.qh:9