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