]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/items/item/armor.qh
4f605c2e606e645ec4f96d3897e85909a9bc8508
[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, 5000);
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(Pickup this, entity item)
26 {
27     if(!item.max_armorvalue)
28         item.max_armorvalue = g_pickup_armorsmall_max;
29     if(!GetResource(item, RES_ARMOR))
30         SetResourceExplicit(item, RES_ARMOR, g_pickup_armorsmall);
31 }
32 #endif
33
34 REGISTER_ITEM(ArmorSmall, Armor) {
35     this.m_canonical_spawnfunc = "item_armor_small";
36 #ifdef GAMEQC
37     this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
38     this.m_model                =   MDL_ArmorSmall_ITEM;
39     this.m_sound                =   SND_ArmorSmall;
40 #endif
41     this.netname                =   "armor_small";
42     this.m_name                 =   _("Small armor");
43     this.m_icon                 =   "armor";
44 #ifdef SVQC
45     this.m_itemid               =   IT_RESOURCE;
46     this.m_respawntime          =   GET(g_pickup_respawntime_short);
47     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
48     this.m_pickupanyway         =   GET(g_pickup_armorsmall_anyway);
49     this.m_iteminit             =   item_armorsmall_init;
50 #endif
51 }
52
53 SPAWNFUNC_ITEM(item_armor_small, ITEM_ArmorSmall)
54
55 #ifdef GAMEQC
56 MODEL(ArmorMedium_ITEM, Item_Model("item_armor_medium.md3"));
57 SOUND(ArmorMedium, Item_Sound("armor10"));
58 #endif
59 #ifdef SVQC
60 PROPERTY(float, g_pickup_armormedium_anyway);
61 PROPERTY(int, g_pickup_armormedium);
62 PROPERTY(int, g_pickup_armormedium_max);
63 void item_armormedium_init(Pickup this, entity item)
64 {
65     if(!item.max_armorvalue)
66         item.max_armorvalue = g_pickup_armormedium_max;
67     if(!GetResource(item, RES_ARMOR))
68         SetResourceExplicit(item, RES_ARMOR, g_pickup_armormedium);
69 }
70 #endif
71
72 REGISTER_ITEM(ArmorMedium, Armor) {
73     this.m_canonical_spawnfunc = "item_armor_medium";
74 #ifdef GAMEQC
75     this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
76     this.m_model                =   MDL_ArmorMedium_ITEM;
77     this.m_sound                =   SND_ArmorMedium;
78 #endif
79     this.netname                =   "armor_medium";
80     this.m_name                 =   _("Medium armor");
81     this.m_icon                 =   "armor";
82 #ifdef SVQC
83     this.m_itemid               =   IT_RESOURCE;
84     this.m_respawntime          =   GET(g_pickup_respawntime_medium);
85     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_medium);
86     this.m_pickupanyway         =   GET(g_pickup_armormedium_anyway);
87     this.m_iteminit             =   item_armormedium_init;
88 #endif
89 }
90
91 SPAWNFUNC_ITEM(item_armor_medium, ITEM_ArmorMedium)
92
93 #ifdef GAMEQC
94 MODEL(ArmorBig_ITEM, Item_Model("item_armor_big.md3"));
95 SOUND(ArmorBig, Item_Sound("armor17_5"));
96 #endif
97 #ifdef SVQC
98 PROPERTY(float, g_pickup_armorbig_anyway);
99 PROPERTY(int, g_pickup_armorbig);
100 PROPERTY(int, g_pickup_armorbig_max);
101 void item_armorbig_init(Pickup this, entity item)
102 {
103     if(!item.max_armorvalue)
104         item.max_armorvalue = g_pickup_armorbig_max;
105     if(!GetResource(item, RES_ARMOR))
106         SetResourceExplicit(item, RES_ARMOR, g_pickup_armorbig);
107 }
108 #endif
109
110 REGISTER_ITEM(ArmorBig, Armor) {
111     this.m_canonical_spawnfunc = "item_armor_big";
112 #ifdef GAMEQC
113     this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
114     this.m_model                =   MDL_ArmorBig_ITEM;
115     this.m_sound                =   SND_ArmorBig;
116 #endif
117     this.netname                =   "armor_big";
118     this.m_name                 =   _("Big armor");
119     this.m_icon                 =   "armor";
120     this.m_color                =   '0 1 0';
121     this.m_waypoint             =   _("Big armor");
122 #ifdef SVQC
123     this.m_itemid               =   IT_RESOURCE;
124     this.m_respawntime          =   GET(g_pickup_respawntime_long);
125     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
126     this.m_pickupanyway         =   GET(g_pickup_armorbig_anyway);
127     this.m_iteminit             =   item_armorbig_init;
128 #endif
129 }
130
131 SPAWNFUNC_ITEM(item_armor_big, ITEM_ArmorBig)
132
133 #ifdef GAMEQC
134 MODEL(ArmorMega_ITEM, Item_Model("item_armor_large.md3"));
135 SOUND(ArmorMega, Item_Sound("armor25"));
136 #endif
137 #ifdef SVQC
138 PROPERTY(float, g_pickup_armormega_anyway);
139 PROPERTY(int, g_pickup_armormega);
140 PROPERTY(int, g_pickup_armormega_max);
141 void item_armormega_init(Pickup this, entity item)
142 {
143     if(!item.max_armorvalue)
144         item.max_armorvalue = g_pickup_armormega_max;
145     if(!GetResource(item, RES_ARMOR))
146         SetResourceExplicit(item, RES_ARMOR, g_pickup_armormega);
147 }
148 #endif
149
150 REGISTER_ITEM(ArmorMega, Armor) {
151     this.m_canonical_spawnfunc = "item_armor_mega";
152 #ifdef GAMEQC
153     this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
154     this.m_model                =   MDL_ArmorMega_ITEM;
155     this.m_sound                =   SND_ArmorMega;
156 #endif
157     this.netname                =   "armor_mega";
158     this.m_name                 =   _("Mega armor");
159     this.m_icon                 =   "item_large_armor";
160     this.m_color                =   '0 1 0';
161     this.m_waypoint             =   _("Mega armor");
162     this.m_waypointblink        =   2;
163 #ifdef SVQC
164     this.m_maxs                 =   '16 16 70';
165     this.m_itemid               =   IT_RESOURCE;
166     this.m_respawntime          =   GET(g_pickup_respawntime_long);
167     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
168     this.m_pickupanyway         =   GET(g_pickup_armormega_anyway);
169     this.m_iteminit             =   item_armormega_init;
170 #endif
171 }
172
173 SPAWNFUNC_ITEM(item_armor_mega, ITEM_ArmorMega)