]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/items/item/powerup.qh
Merge branch 'master' into bones_was_here/q3compat
[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_damage;
28 float autocvar_g_balance_powerup_strength_force;
29 float autocvar_g_balance_powerup_strength_selfdamage;
30 float autocvar_g_balance_powerup_strength_selfforce;
31 float autocvar_g_balance_powerup_strength_time;
32 void powerup_strength_init(Pickup this, entity item)
33 {
34     if(!item.strength_finished)
35         item.strength_finished = (item.count) ? item.count : autocvar_g_balance_powerup_strength_time;
36 }
37 #endif
38 REGISTER_ITEM(Strength, Powerup) {
39     this.m_canonical_spawnfunc = "item_strength";
40 #ifdef GAMEQC
41         this.spawnflags = ITEM_FLAG_NORMAL;
42     this.m_model            =   MDL_Strength_ITEM;
43     this.m_sound            =   SND_Strength;
44     this.m_glow             =   true;
45     this.m_respawnsound     =   SND_STRENGTH_RESPAWN;
46 #endif
47     this.netname            =   "strength";
48     this.m_name             =   _("Strength");
49     this.m_icon             =   "strength";
50     this.m_color            =   '0 0 1';
51     this.m_waypoint         =   _("Strength");
52     this.m_waypointblink    =   2;
53 #ifdef GAMEQC
54     this.m_itemid           =   IT_STRENGTH;
55 #endif
56 #ifdef SVQC
57     this.m_iteminit         =   powerup_strength_init;
58 #endif
59 }
60
61 SPAWNFUNC_ITEM(item_strength, ITEM_Strength)
62
63 #ifdef GAMEQC
64 MODEL(Shield_ITEM, Item_Model("g_invincible.md3"));
65 SOUND(Shield, Item_Sound("powerup_shield"));
66 #endif
67
68 #ifdef SVQC
69 float autocvar_g_balance_powerup_invincible_takedamage;
70 float autocvar_g_balance_powerup_invincible_takeforce = 0.33;
71 float autocvar_g_balance_powerup_invincible_time;
72 void powerup_shield_init(Pickup this, entity item)
73 {
74     if(!item.invincible_finished)
75         item.invincible_finished = (item.count) ? item.count : autocvar_g_balance_powerup_invincible_time;
76 }
77 #endif
78 REGISTER_ITEM(Shield, Powerup) {
79     this.m_canonical_spawnfunc = "item_shield";
80 #ifdef GAMEQC
81         this.spawnflags = ITEM_FLAG_NORMAL;
82     this.m_model            =   MDL_Shield_ITEM;
83     this.m_sound            =   SND_Shield;
84     this.m_glow             =   true;
85     this.m_respawnsound     =   SND_SHIELD_RESPAWN;
86 #endif
87     this.netname            =   "invincible";
88     this.m_name             =   _("Shield");
89     this.m_icon             =   "shield";
90     this.m_color            =   '1 0 1';
91     this.m_waypoint         =   _("Shield");
92     this.m_waypointblink    =   2;
93 #ifdef GAMEQC
94     this.m_itemid           =   IT_INVINCIBLE;
95 #endif
96 #ifdef SVQC
97     this.m_iteminit         =   powerup_shield_init;
98 #endif
99 }
100
101 SPAWNFUNC_ITEM(item_shield, ITEM_Shield)
102 SPAWNFUNC_ITEM(item_invincible, ITEM_Shield)