]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/powerups/powerup/invisibility.qh
Merge branch 'master' into pending-release
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / powerups / powerup / invisibility.qh
1 #pragma once
2
3 #include <common/items/all.qh>
4 #include <common/mutators/mutator/powerups/powerups.qh>
5 #ifdef SVQC
6     // For FL_POWERUP
7     #include <common/constants.qh>
8     #include <server/items/items.qh>
9 #endif
10
11 #ifdef GAMEQC
12 //MODEL(Invisibility_ITEM, Item_Model("g_strength.md3")); // TODO: new model required
13 SOUND(Invisibility, Item_Sound("powerup"));
14 #endif
15
16 #ifdef SVQC
17 .float invisibility_finished;
18
19 bool autocvar_g_powerups_invisibility = 1;
20 float autocvar_g_balance_powerup_invisibility_alpha = 0.15;
21 float autocvar_g_balance_powerup_invisibility_time = 30;
22 void powerup_invisibility_init(Pickup this, entity item)
23 {
24     if(autocvar_g_powerups_invisibility)
25         this.spawnflags = ITEM_FLAG_NORMAL;
26     else
27         this.spawnflags = ITEM_FLAG_MUTATORBLOCKED;
28
29     if(!item.invisibility_finished)
30         item.invisibility_finished = (item.count) ? item.count : autocvar_g_balance_powerup_invisibility_time;
31 }
32 #endif
33 REGISTER_ITEM(Invisibility, Powerup) {
34     this.m_canonical_spawnfunc = "item_invisibility";
35 #ifdef SVQC
36     this.m_iteminit         =   powerup_invisibility_init;
37 #endif
38 #ifdef GAMEQC
39     this.m_itemid           =   IT_INVISIBILITY;
40     this.m_model            =   MDL_BUFF; // TODO: MDL_Invisibility_ITEM when new model available
41     this.m_skin             =   12;
42     this.m_sound            =   SND_Invisibility;
43     this.m_glow             =   true;
44     this.m_respawnsound     =   SND_STRENGTH_RESPAWN;
45 #endif
46     this.netname            =   "invisibility";
47     this.m_name             =   _("Invisibility");
48     this.m_icon             =   "buff_invisible";
49     this.m_color            =   '0.5 0.5 1';
50     this.m_waypoint         =   _("Invisibility");
51     this.m_waypointblink    =   2;
52 }
53
54 SPAWNFUNC_ITEM(item_invisibility, ITEM_Invisibility)
55
56 CLASS(Invisibility, Powerups)
57     ATTRIB(Invisibility, netname, string, "invisibility");
58     ATTRIB(Invisibility, m_name, string, _("Invisibility"));
59     ATTRIB(Invisibility, m_color, vector, '0.5 0.5 1');
60     ATTRIB(Invisibility, m_icon, string, "buff_invisible");
61 ENDCLASS(Invisibility)
62 REGISTER_STATUSEFFECT(Invisibility, NEW(Invisibility));