]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/items/item/armor.qh
Transifex autosync
[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_pickupevalfunc, float(entity player, entity item), healtharmor_pickupevalfunc);
7     ATTRIB(Armor, m_botvalue, int, 5000);
8 #endif
9 ENDCLASS(Armor)
10
11 #ifdef SVQC
12     #include <server/items/items.qh>
13 #endif
14
15 #ifdef GAMEQC
16 MODEL(ArmorSmall_ITEM, Item_Model("item_armor_small.md3"));
17 SOUND(ArmorSmall, Item_Sound("armor1"));
18 #endif
19 #ifdef SVQC
20 PROPERTY(float, g_pickup_armorsmall_anyway);
21 PROPERTY(int, g_pickup_armorsmall);
22 PROPERTY(int, g_pickup_armorsmall_max);
23 void item_armorsmall_init(Pickup this, entity item)
24 {
25     if(!item.max_armorvalue)
26         item.max_armorvalue = g_pickup_armorsmall_max;
27     if(!GetResource(item, RES_ARMOR))
28         SetResourceExplicit(item, RES_ARMOR, g_pickup_armorsmall);
29 }
30 #endif
31
32 REGISTER_ITEM(ArmorSmall, Armor) {
33     this.m_canonical_spawnfunc = "item_armor_small";
34 #ifdef GAMEQC
35     this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
36     this.m_model                =   MDL_ArmorSmall_ITEM;
37     this.m_sound                =   SND_ArmorSmall;
38 #endif
39     this.netname                =   "armor_small";
40     this.m_name                 =   _("Small armor");
41     this.m_icon                 =   "armor_small";
42 #ifdef CSQC
43     if(precache_pic(strcat("gfx/hud/luma/", this.m_icon)) == "")
44         this.m_icon             =   "armor"; // compatible with Xonotic v0.8.2 or lower
45 #endif
46 #ifdef SVQC
47     this.m_mins                 =   ITEM_S_MINS;
48     this.m_maxs                 =   ITEM_S_MAXS;
49     this.m_itemid               =   IT_RESOURCE;
50     this.m_respawntime          =   GET(g_pickup_respawntime_armor_small);
51     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_armor_small);
52     this.m_pickupanyway         =   GET(g_pickup_armorsmall_anyway);
53     this.m_iteminit             =   item_armorsmall_init;
54 #endif
55 }
56
57 SPAWNFUNC_ITEM(item_armor_small, ITEM_ArmorSmall)
58
59 #ifdef GAMEQC
60 MODEL(ArmorMedium_ITEM, Item_Model("item_armor_medium.md3"));
61 SOUND(ArmorMedium, Item_Sound("armor10"));
62 #endif
63 #ifdef SVQC
64 PROPERTY(float, g_pickup_armormedium_anyway);
65 PROPERTY(int, g_pickup_armormedium);
66 PROPERTY(int, g_pickup_armormedium_max);
67 void item_armormedium_init(Pickup this, entity item)
68 {
69     if(!item.max_armorvalue)
70         item.max_armorvalue = g_pickup_armormedium_max;
71     if(!GetResource(item, RES_ARMOR))
72         SetResourceExplicit(item, RES_ARMOR, g_pickup_armormedium);
73 }
74 #endif
75
76 REGISTER_ITEM(ArmorMedium, Armor) {
77     this.m_canonical_spawnfunc = "item_armor_medium";
78 #ifdef GAMEQC
79     this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
80     this.m_model                =   MDL_ArmorMedium_ITEM;
81     this.m_sound                =   SND_ArmorMedium;
82 #endif
83     this.netname                =   "armor_medium";
84     this.m_name                 =   _("Medium armor");
85     this.m_icon                 =   "armor_medium";
86 #ifdef CSQC
87     if(precache_pic(strcat("gfx/hud/luma/", this.m_icon)) == "")
88         this.m_icon             =   "armor"; // compatible with Xonotic v0.8.2 or lower
89 #endif
90 #ifdef SVQC
91     this.m_mins                 =   ITEM_S_MINS;
92     this.m_maxs                 =   ITEM_S_MAXS;
93     this.m_itemid               =   IT_RESOURCE;
94     this.m_respawntime          =   GET(g_pickup_respawntime_armor_medium);
95     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_armor_medium);
96     this.m_pickupanyway         =   GET(g_pickup_armormedium_anyway);
97     this.m_iteminit             =   item_armormedium_init;
98 #endif
99 }
100
101 SPAWNFUNC_ITEM(item_armor_medium, ITEM_ArmorMedium)
102
103 #ifdef GAMEQC
104 MODEL(ArmorBig_ITEM, Item_Model("item_armor_big.md3"));
105 SOUND(ArmorBig, Item_Sound("armor17_5"));
106 #endif
107 #ifdef SVQC
108 PROPERTY(float, g_pickup_armorbig_anyway);
109 PROPERTY(int, g_pickup_armorbig);
110 PROPERTY(int, g_pickup_armorbig_max);
111 void item_armorbig_init(Pickup this, entity item)
112 {
113     if(!item.max_armorvalue)
114         item.max_armorvalue = g_pickup_armorbig_max;
115     if(!GetResource(item, RES_ARMOR))
116         SetResourceExplicit(item, RES_ARMOR, g_pickup_armorbig);
117 }
118 #endif
119
120 REGISTER_ITEM(ArmorBig, Armor) {
121     this.m_canonical_spawnfunc = "item_armor_big";
122 #ifdef GAMEQC
123     this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
124     this.m_model                =   MDL_ArmorBig_ITEM;
125     this.m_sound                =   SND_ArmorBig;
126 #endif
127     this.netname                =   "armor_big";
128     this.m_name                 =   _("Big armor");
129     this.m_icon                 =   "armor_big";
130 #ifdef CSQC
131     if(precache_pic(strcat("gfx/hud/luma/", this.m_icon)) == "")
132         this.m_icon             =   "armor"; // compatible with Xonotic v0.8.2 or lower
133 #endif
134     this.m_color                =   '0 1 0';
135     this.m_waypoint             =   _("Big armor");
136 #ifdef SVQC
137     this.m_itemid               =   IT_RESOURCE;
138     this.m_respawntime          =   GET(g_pickup_respawntime_armor_big);
139     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_armor_big);
140     this.m_pickupanyway         =   GET(g_pickup_armorbig_anyway);
141     this.m_iteminit             =   item_armorbig_init;
142 #endif
143 }
144
145 SPAWNFUNC_ITEM(item_armor_big, ITEM_ArmorBig)
146
147 #ifdef GAMEQC
148 MODEL(ArmorMega_ITEM, Item_Model("item_armor_large.md3"));
149 SOUND(ArmorMega, Item_Sound("armor25"));
150 #endif
151 #ifdef SVQC
152 PROPERTY(float, g_pickup_armormega_anyway);
153 PROPERTY(int, g_pickup_armormega);
154 PROPERTY(int, g_pickup_armormega_max);
155 void item_armormega_init(Pickup this, entity item)
156 {
157     if(!item.max_armorvalue)
158         item.max_armorvalue = g_pickup_armormega_max;
159     if(!GetResource(item, RES_ARMOR))
160         SetResourceExplicit(item, RES_ARMOR, g_pickup_armormega);
161 }
162 #endif
163
164 REGISTER_ITEM(ArmorMega, Armor) {
165     this.m_canonical_spawnfunc = "item_armor_mega";
166 #ifdef GAMEQC
167     this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
168     this.m_model                =   MDL_ArmorMega_ITEM;
169     this.m_sound                =   SND_ArmorMega;
170 #endif
171     this.netname                =   "armor_mega";
172     this.m_name                 =   _("Mega armor");
173     this.m_icon                 =   "armor_mega";
174 #ifdef CSQC
175     if(precache_pic(strcat("gfx/hud/luma/", this.m_icon)) == "")
176         this.m_icon             =   "item_large_armor"; // compatible with Xonotic v0.8.2 or lower
177 #endif
178     this.m_color                =   '0 1 0';
179     this.m_waypoint             =   _("Mega armor");
180     this.m_waypointblink        =   2;
181 #ifdef SVQC
182     this.m_maxs                 =   ITEM_L_MAXS;
183     this.m_itemid               =   IT_RESOURCE;
184     this.m_respawntime          =   GET(g_pickup_respawntime_armor_mega);
185     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_armor_mega);
186     this.m_pickupanyway         =   GET(g_pickup_armormega_anyway);
187     this.m_iteminit             =   item_armormega_init;
188 #endif
189 }
190
191 SPAWNFUNC_ITEM(item_armor_mega, ITEM_ArmorMega)