]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/items/item/powerup.qh
Remove weapon-specific code from target_give_init and support count field on powerup...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item / powerup.qh
1 #pragma once
2
3 #ifdef SVQC
4     // For FL_POWERUP
5     #include <common/constants.qh>
6 #endif
7
8 #include "pickup.qh"
9 CLASS(Powerup, Pickup)
10 #ifdef SVQC
11     ATTRIB(Powerup, m_mins, vector, '-16 -16 0');
12     ATTRIB(Powerup, m_maxs, vector, '16 16 80');
13     ATTRIB(Powerup, m_botvalue, int, 11000);
14     ATTRIB(Powerup, m_itemflags, int, FL_POWERUP);
15     ATTRIB(Powerup, m_respawntime, float(), GET(g_pickup_respawntime_powerup));
16     ATTRIB(Powerup, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_powerup));
17     ATTRIB(Powerup, count, float);
18 #endif
19 ENDCLASS(Powerup)
20
21 #ifdef GAMEQC
22 MODEL(Strength_ITEM, Item_Model("g_strength.md3"));
23 SOUND(Strength, Item_Sound("powerup"));
24 #endif
25
26 #ifdef SVQC
27 float autocvar_g_balance_powerup_strength_time;
28 void powerup_strength_init(Pickup this, entity item)
29 {
30     if(!item.strength_finished)
31         item.strength_finished = (item.count) ? item.count : autocvar_g_balance_powerup_strength_time;
32 }
33 #endif
34 REGISTER_ITEM(Strength, Powerup) {
35     this.m_canonical_spawnfunc = "item_strength";
36 #ifdef GAMEQC
37         this.spawnflags = ITEM_FLAG_NORMAL;
38     this.m_model            =   MDL_Strength_ITEM;
39     this.m_sound            =   SND_Strength;
40     this.m_glow             =   true;
41     this.m_respawnsound     =   SND_STRENGTH_RESPAWN;
42 #endif
43     this.netname            =   "strength";
44     this.m_name             =   _("Strength");
45     this.m_icon             =   "strength";
46     this.m_color            =   '0 0 1';
47     this.m_waypoint         =   _("Strength");
48     this.m_waypointblink    =   2;
49 #ifdef GAMEQC
50     this.m_itemid           =   IT_STRENGTH;
51 #endif
52 #ifdef SVQC
53     this.m_iteminit         =   powerup_strength_init;
54 #endif
55 }
56
57 SPAWNFUNC_ITEM(item_strength, ITEM_Strength)
58
59 #ifdef GAMEQC
60 MODEL(Shield_ITEM, Item_Model("g_invincible.md3"));
61 SOUND(Shield, Item_Sound("powerup_shield"));
62 #endif
63
64 #ifdef SVQC
65 float autocvar_g_balance_powerup_invincible_time;
66 void powerup_shield_init(Pickup this, entity item)
67 {
68     if(!item.invincible_finished)
69         item.invincible_finished = (item.count) ? item.count : autocvar_g_balance_powerup_invincible_time;
70 }
71 #endif
72 REGISTER_ITEM(Shield, Powerup) {
73     this.m_canonical_spawnfunc = "item_shield";
74 #ifdef GAMEQC
75         this.spawnflags = ITEM_FLAG_NORMAL;
76     this.m_model            =   MDL_Shield_ITEM;
77     this.m_sound            =   SND_Shield;
78     this.m_glow             =   true;
79     this.m_respawnsound     =   SND_SHIELD_RESPAWN;
80 #endif
81     this.netname            =   "invincible";
82     this.m_name             =   _("Shield");
83     this.m_icon             =   "shield";
84     this.m_color            =   '1 0 1';
85     this.m_waypoint         =   _("Shield");
86     this.m_waypointblink    =   2;
87 #ifdef GAMEQC
88     this.m_itemid           =   IT_INVINCIBLE;
89 #endif
90 #ifdef SVQC
91     this.m_iteminit         =   powerup_shield_init;
92 #endif
93 }
94
95 SPAWNFUNC_ITEM(item_shield, ITEM_Shield)
96 SPAWNFUNC_ITEM(item_invincible, ITEM_Shield)