]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/items/item/ammo.qh
Merge branch 'master' into martin-t/defaults
[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(Pickup this, 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.spawnflags = ITEM_FLAG_NORMAL;
55     this.m_model    =   MDL_Bullets_ITEM;
56 #endif
57     this.netname    =   "bullets";
58     this.m_name     =   "bullets";
59     this.m_icon     =   "ammo_bullets";
60 #ifdef SVQC
61     this.m_botvalue =   1500;
62     this.m_itemid   =   IT_NAILS;
63     this.m_iteminit =   ammo_bullets_init;
64 #endif
65 }
66
67 SPAWNFUNC_ITEM(item_bullets, ITEM_Bullets)
68
69 #ifdef GAMEQC
70 MODEL(Cells_ITEM, Item_Model("a_cells.md3"));
71 #endif
72
73 #ifdef SVQC
74 PROPERTY(int, g_pickup_cells);
75 void ammo_cells_init(Pickup this, entity item)
76 {
77     if(!item.ammo_cells)
78         item.ammo_cells = g_pickup_cells;
79 }
80 #endif
81 REGISTER_ITEM(Cells, Ammo) {
82     this.m_canonical_spawnfunc = "item_cells";
83 #ifdef GAMEQC
84         this.spawnflags = ITEM_FLAG_NORMAL;
85     this.m_model    =   MDL_Cells_ITEM;
86 #endif
87     this.netname    =   "cells";
88     this.m_name     =   "cells";
89     this.m_icon     =   "ammo_cells";
90 #ifdef SVQC
91     this.m_botvalue =   1500;
92     this.m_itemid   =   IT_CELLS;
93     this.m_iteminit =   ammo_cells_init;
94 #endif
95 }
96
97 SPAWNFUNC_ITEM(item_cells, ITEM_Cells)
98
99 #ifdef GAMEQC
100 MODEL(Plasma_ITEM, Item_Model("a_cells.md3"));
101 #endif
102
103 #ifdef SVQC
104 PROPERTY(int, g_pickup_plasma);
105 void ammo_plasma_init(Pickup this, entity item)
106 {
107     if(!item.ammo_plasma)
108         item.ammo_plasma = g_pickup_plasma;
109 }
110 #endif
111 REGISTER_ITEM(Plasma, Ammo) {
112     this.m_canonical_spawnfunc = "item_plasma";
113 #ifdef GAMEQC
114         this.spawnflags = ITEM_FLAG_NORMAL;
115     this.m_model    =   MDL_Plasma_ITEM;
116 #endif
117     this.netname    =   "plasma";
118     this.m_name     =   "plasma";
119     this.m_icon     =   "ammo_plasma";
120 #ifdef SVQC
121     this.m_botvalue =   1500;
122     this.m_itemid   =   IT_PLASMA;
123     this.m_iteminit =   ammo_plasma_init;
124 #endif
125 }
126
127 SPAWNFUNC_ITEM(item_plasma, ITEM_Plasma)
128
129 #ifdef GAMEQC
130 MODEL(Rockets_ITEM, Item_Model("a_rockets.md3"));
131 #endif
132
133 #ifdef SVQC
134 PROPERTY(int, g_pickup_rockets);
135 void ammo_rockets_init(Pickup this, entity item)
136 {
137     if(!item.ammo_rockets)
138         item.ammo_rockets = g_pickup_rockets;
139 }
140 #endif
141 REGISTER_ITEM(Rockets, Ammo) {
142     this.m_canonical_spawnfunc = "item_rockets";
143 #ifdef GAMEQC
144         this.spawnflags = ITEM_FLAG_NORMAL;
145     this.m_model    =   MDL_Rockets_ITEM;
146 #endif
147     this.netname    =   "rockets";
148     this.m_name     =   "rockets";
149     this.m_icon     =   "ammo_rockets";
150 #ifdef SVQC
151     this.m_botvalue =   1500;
152     this.m_itemid   =   IT_ROCKETS;
153     this.m_iteminit =   ammo_rockets_init;
154 #endif
155 }
156
157 SPAWNFUNC_ITEM(item_rockets, ITEM_Rockets)
158
159 #ifdef GAMEQC
160 MODEL(Shells_ITEM, Item_Model("a_shells.md3"));
161 #endif
162
163 #ifdef SVQC
164 PROPERTY(int, g_pickup_shells);
165 void ammo_shells_init(Pickup this, entity item)
166 {
167     if(!item.ammo_shells)
168         item.ammo_shells = g_pickup_shells;
169 }
170 #endif
171
172 CLASS(Shells, Ammo)
173 ENDCLASS(Shells)
174
175 REGISTER_ITEM(Shells, Shells) {
176     this.m_canonical_spawnfunc = "item_shells";
177 #ifdef GAMEQC
178         this.spawnflags = ITEM_FLAG_NORMAL;
179     this.m_model    =   MDL_Shells_ITEM;
180 #endif
181     this.netname    =   "shells";
182     this.m_name     =   "shells";
183     this.m_icon     =   "ammo_shells";
184 #ifdef SVQC
185     this.m_botvalue =   1000;
186     this.m_itemid   =   IT_SHELLS;
187     this.m_iteminit =   ammo_shells_init;
188 #endif
189 }
190
191 SPAWNFUNC_ITEM(item_shells, ITEM_Shells)