]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/items/item/ammo.qh
Merge branch 'master' into Lyberta/RandomItems
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item / ammo.qh
1 #pragma once
2
3 #include "pickup.qh"
4 #ifdef SVQC
5     #include <common/t_items.qh>
6 #endif
7
8 .int ammo_none;
9 .int ammo_shells;
10 .int ammo_nails;
11 .int ammo_rockets;
12 .int ammo_cells;
13 #ifdef SVQC
14 .int ammo_plasma = _STAT(PLASMA);
15 .int ammo_fuel = _STAT(FUEL);
16 #else
17 .int ammo_plasma;
18 .int ammo_fuel;
19 #endif
20
21 #ifdef SVQC
22 PROPERTY(float, g_pickup_ammo_anyway);
23 #endif
24
25 CLASS(Ammo, Pickup)
26 #ifdef SVQC
27     ATTRIB(Ammo, m_pickupevalfunc, float(entity player, entity item), ammo_pickupevalfunc);
28     ATTRIB(Ammo, m_respawntime, float(), GET(g_pickup_respawntime_ammo));
29     ATTRIB(Ammo, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_ammo));
30     ATTRIB(Ammo, m_pickupanyway, float(), GET(g_pickup_ammo_anyway));
31 #endif
32 ENDCLASS(Ammo)
33
34
35 #ifdef GAMEQC
36 MODEL(Bullets_ITEM, Item_Model("a_bullets.mdl"));
37 #endif
38
39 #ifdef SVQC
40 PROPERTY(int, g_pickup_nails);
41 void ammo_bullets_init(entity item)
42 {
43     if(!item.ammo_nails)
44         item.ammo_nails = g_pickup_nails;
45 }
46 #endif
47
48 CLASS(Bullets, Ammo)
49 ENDCLASS(Bullets)
50
51 REGISTER_ITEM(Bullets, Bullets) {
52     this.m_canonical_spawnfunc = "item_bullets";
53 #ifdef GAMEQC
54     this.m_model    =   MDL_Bullets_ITEM;
55 #endif
56     this.netname    =   "bullets";
57     this.m_name     =   "bullets";
58     this.m_icon     =   "ammo_bullets";
59 #ifdef SVQC
60     this.m_botvalue =   1500;
61     this.m_itemid   =   IT_NAILS;
62     this.m_iteminit =   ammo_bullets_init;
63 #endif
64 }
65
66 SPAWNFUNC_ITEM(item_bullets, ITEM_Bullets)
67
68 #ifdef GAMEQC
69 MODEL(Cells_ITEM, Item_Model("a_cells.md3"));
70 #endif
71
72 #ifdef SVQC
73 PROPERTY(int, g_pickup_cells);
74 void ammo_cells_init(entity item)
75 {
76     if(!item.ammo_cells)
77         item.ammo_cells = g_pickup_cells;
78 }
79 #endif
80 REGISTER_ITEM(Cells, Ammo) {
81     this.m_canonical_spawnfunc = "item_cells";
82 #ifdef GAMEQC
83     this.m_model    =   MDL_Cells_ITEM;
84 #endif
85     this.netname    =   "cells";
86     this.m_name     =   "cells";
87     this.m_icon     =   "ammo_cells";
88 #ifdef SVQC
89     this.m_botvalue =   1500;
90     this.m_itemid   =   IT_CELLS;
91     this.m_iteminit =   ammo_cells_init;
92 #endif
93 }
94
95 SPAWNFUNC_ITEM(item_cells, ITEM_Cells)
96
97 #ifdef GAMEQC
98 MODEL(Plasma_ITEM, Item_Model("a_cells.md3"));
99 #endif
100
101 #ifdef SVQC
102 PROPERTY(int, g_pickup_plasma);
103 void ammo_plasma_init(entity item)
104 {
105     if(!item.ammo_plasma)
106         item.ammo_plasma = g_pickup_plasma;
107 }
108 #endif
109 REGISTER_ITEM(Plasma, Ammo) {
110     this.m_canonical_spawnfunc = "item_plasma";
111 #ifdef GAMEQC
112     this.m_model    =   MDL_Plasma_ITEM;
113 #endif
114     this.netname    =   "plasma";
115     this.m_name     =   "plasma";
116     this.m_icon     =   "ammo_plasma";
117 #ifdef SVQC
118     this.m_botvalue =   1500;
119     this.m_itemid   =   IT_PLASMA;
120     this.m_iteminit =   ammo_plasma_init;
121 #endif
122 }
123
124 SPAWNFUNC_ITEM(item_plasma, ITEM_Plasma)
125
126 #ifdef GAMEQC
127 MODEL(Rockets_ITEM, Item_Model("a_rockets.md3"));
128 #endif
129
130 #ifdef SVQC
131 PROPERTY(int, g_pickup_rockets);
132 void ammo_rockets_init(entity item)
133 {
134     if(!item.ammo_rockets)
135         item.ammo_rockets = g_pickup_rockets;
136 }
137 #endif
138 REGISTER_ITEM(Rockets, Ammo) {
139     this.m_canonical_spawnfunc = "item_rockets";
140 #ifdef GAMEQC
141     this.m_model    =   MDL_Rockets_ITEM;
142 #endif
143     this.netname    =   "rockets";
144     this.m_name     =   "rockets";
145     this.m_icon     =   "ammo_rockets";
146 #ifdef SVQC
147     this.m_botvalue =   1500;
148     this.m_itemid   =   IT_ROCKETS;
149     this.m_iteminit =   ammo_rockets_init;
150 #endif
151 }
152
153 SPAWNFUNC_ITEM(item_rockets, ITEM_Rockets)
154
155 #ifdef GAMEQC
156 MODEL(Shells_ITEM, Item_Model("a_shells.md3"));
157 #endif
158
159 #ifdef SVQC
160 PROPERTY(int, g_pickup_shells);
161 void ammo_shells_init(entity item)
162 {
163     if(!item.ammo_shells)
164         item.ammo_shells = g_pickup_shells;
165 }
166 #endif
167
168 CLASS(Shells, Ammo)
169 ENDCLASS(Shells)
170
171 REGISTER_ITEM(Shells, Shells) {
172     this.m_canonical_spawnfunc = "item_shells";
173 #ifdef GAMEQC
174     this.m_model    =   MDL_Shells_ITEM;
175 #endif
176     this.netname    =   "shells";
177     this.m_name     =   "shells";
178     this.m_icon     =   "ammo_shells";
179 #ifdef SVQC
180     this.m_botvalue =   1000;
181     this.m_itemid   =   IT_SHELLS;
182     this.m_iteminit =   ammo_shells_init;
183 #endif
184 }
185
186 SPAWNFUNC_ITEM(item_shells, ITEM_Shells)