]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/items/item/armor.qh
Add an item init attribute function, so the item's default values aren't applied...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item / armor.qh
1 #pragma once
2
3 #include "pickup.qh"
4 CLASS(Armor, Pickup)
5 #ifdef SVQC
6     ATTRIB(Armor, m_mins, vector, '-16 -16 0');
7     ATTRIB(Armor, m_maxs, vector, '16 16 48');
8     ATTRIB(Armor, m_pickupevalfunc, float(entity player, entity item), healtharmor_pickupevalfunc);
9     ATTRIB(Armor, m_botvalue, int, 3000);
10 #endif
11 ENDCLASS(Armor)
12
13 #ifdef SVQC
14     #include <common/t_items.qh>
15 #endif
16
17 #ifdef GAMEQC
18 MODEL(ArmorSmall_ITEM, Item_Model("item_armor_small.md3"));
19 SOUND(ArmorSmall, Item_Sound("armor1"));
20 #endif
21 #ifdef SVQC
22 PROPERTY(float, g_pickup_armorsmall_anyway);
23 PROPERTY(int, g_pickup_armorsmall);
24 PROPERTY(int, g_pickup_armorsmall_max);
25 void item_armorsmall_init(entity item)
26 {
27     if(!item.max_armorvalue)
28         item.max_armorvalue = g_pickup_armorsmall_max;
29     if(!item.armorvalue)
30         item.armorvalue = g_pickup_armorsmall;
31 }
32 #endif
33
34 REGISTER_ITEM(ArmorSmall, Armor) {
35 #ifdef GAMEQC
36     this.m_model                =   MDL_ArmorSmall_ITEM;
37     this.m_sound                =   SND_ArmorSmall;
38 #endif
39     this.m_name                 =   "5 Armor";
40     this.m_icon                 =   "armor";
41 #ifdef SVQC
42     this.m_itemid               =   IT_ARMOR_SHARD;
43     this.m_respawntime          =   GET(g_pickup_respawntime_short);
44     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
45     this.m_pickupanyway         =   GET(g_pickup_armorsmall_anyway);
46     this.m_iteminit             =   item_armorsmall_init;
47 #endif
48 }
49
50 #ifdef GAMEQC
51 MODEL(ArmorMedium_ITEM, Item_Model("item_armor_medium.md3"));
52 SOUND(ArmorMedium, Item_Sound("armor10"));
53 #endif
54 #ifdef SVQC
55 PROPERTY(float, g_pickup_armormedium_anyway);
56 PROPERTY(int, g_pickup_armormedium);
57 PROPERTY(int, g_pickup_armormedium_max);
58 void item_armormedium_init(entity item)
59 {
60     if(!item.max_armorvalue)
61         item.max_armorvalue = g_pickup_armormedium_max;
62     if(!item.armorvalue)
63         item.armorvalue = g_pickup_armormedium;
64 }
65 #endif
66
67 REGISTER_ITEM(ArmorMedium, Armor) {
68 #ifdef GAMEQC
69     this.m_model                =   MDL_ArmorMedium_ITEM;
70     this.m_sound                =   SND_ArmorMedium;
71 #endif
72     this.m_name                 =   "25 Armor";
73     this.m_icon                 =   "armor";
74 #ifdef SVQC
75     this.m_itemid               =   IT_ARMOR;
76     this.m_respawntime          =   GET(g_pickup_respawntime_medium);
77     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_medium);
78     this.m_pickupanyway         =   GET(g_pickup_armormedium_anyway);
79     this.m_iteminit             =   item_armormedium_init;
80 #endif
81 }
82
83 #ifdef GAMEQC
84 MODEL(ArmorBig_ITEM, Item_Model("item_armor_big.md3"));
85 SOUND(ArmorBig, Item_Sound("armor17_5"));
86 #endif
87 #ifdef SVQC
88 PROPERTY(float, g_pickup_armorbig_anyway);
89 PROPERTY(int, g_pickup_armorbig);
90 PROPERTY(int, g_pickup_armorbig_max);
91 void item_armorbig_init(entity item)
92 {
93     if(!item.max_armorvalue)
94         item.max_armorvalue = g_pickup_armorbig_max;
95     if(!item.armorvalue)
96         item.armorvalue = g_pickup_armorbig;
97 }
98 #endif
99
100 REGISTER_ITEM(ArmorBig, Armor) {
101 #ifdef GAMEQC
102     this.m_model                =   MDL_ArmorBig_ITEM;
103     this.m_sound                =   SND_ArmorBig;
104 #endif
105     this.m_name                 =   "50 Armor";
106     this.m_icon                 =   "armor";
107     this.m_color                =   '0 1 0';
108     this.m_waypoint             =   _("Big armor");
109 #ifdef SVQC
110     this.m_itemid               =   IT_ARMOR;
111     this.m_respawntime          =   GET(g_pickup_respawntime_long);
112     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
113     this.m_pickupanyway         =   GET(g_pickup_armorbig_anyway);
114     this.m_iteminit             =   item_armorbig_init;
115 #endif
116 }
117
118 #ifdef GAMEQC
119 MODEL(ArmorMega_ITEM, Item_Model("item_armor_large.md3"));
120 SOUND(ArmorMega, Item_Sound("armor25"));
121 #endif
122 #ifdef SVQC
123 PROPERTY(float, g_pickup_armormega_anyway);
124 PROPERTY(int, g_pickup_armormega);
125 PROPERTY(int, g_pickup_armormega_max);
126 void item_armormega_init(entity item)
127 {
128     if(!item.max_armorvalue)
129         item.max_armorvalue = g_pickup_armormega_max;
130     if(!item.armorvalue)
131         item.armorvalue = g_pickup_armormega;
132 }
133 #endif
134
135 REGISTER_ITEM(ArmorMega, Armor) {
136 #ifdef GAMEQC
137     this.m_model                =   MDL_ArmorMega_ITEM;
138     this.m_sound                =   SND_ArmorMega;
139 #endif
140     this.m_name                 =   "100 Armor";
141     this.m_icon                 =   "item_large_armor";
142     this.m_color                =   '0 1 0';
143     this.m_waypoint             =   _("Mega armor");
144     this.m_waypointblink        =   2;
145 #ifdef SVQC
146     this.m_maxs                 =   '16 16 70';
147     this.m_itemid               =   IT_ARMOR;
148     this.m_respawntime          =   GET(g_pickup_respawntime_long);
149     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
150     this.m_pickupanyway         =   GET(g_pickup_armormega_anyway);
151     this.m_iteminit             =   item_armormega_init;
152 #endif
153 }