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