]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/items/item/ammo.qh
Add an item init attribute function, so the item's default values aren't applied...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item / ammo.qh
1 #pragma once
2
3 #include "pickup.qh"
4 #ifdef SVQC
5 PROPERTY(float, g_pickup_ammo_anyway);
6 #endif
7
8 CLASS(Ammo, Pickup)
9 #ifdef SVQC
10     ATTRIB(Ammo, m_pickupevalfunc, float(entity player, entity item), ammo_pickupevalfunc);
11     ATTRIB(Ammo, m_respawntime, float(), GET(g_pickup_respawntime_ammo));
12     ATTRIB(Ammo, m_respawntimejitter, float(), GET(g_pickup_respawntimejitter_ammo));
13     ATTRIB(Ammo, m_pickupanyway, float(), GET(g_pickup_ammo_anyway));
14 #endif
15 ENDCLASS(Ammo)
16
17 #ifdef SVQC
18     #include <common/t_items.qh>
19 #endif
20
21 #ifdef GAMEQC
22 MODEL(Bullets_ITEM, Item_Model("a_bullets.mdl"));
23 #endif
24
25 #ifdef SVQC
26 PROPERTY(int, g_pickup_nails);
27 void ammo_bullets_init(entity item)
28 {
29     if(!item.ammo_nails)
30         item.ammo_nails = g_pickup_nails;
31 }
32 #endif
33 REGISTER_ITEM(Bullets, Ammo) {
34 #ifdef GAMEQC
35     this.m_model    =   MDL_Bullets_ITEM;
36 #endif
37     this.m_name     =   "bullets";
38     this.m_icon     =   "ammo_bullets";
39 #ifdef SVQC
40     this.m_botvalue =   1500;
41     this.m_itemid   =   IT_NAILS;
42     this.m_iteminit =   ammo_bullets_init;
43 #endif
44 }
45
46 #ifdef GAMEQC
47 MODEL(Cells_ITEM, Item_Model("a_cells.md3"));
48 #endif
49
50 #ifdef SVQC
51 PROPERTY(int, g_pickup_cells);
52 void ammo_cells_init(entity item)
53 {
54     if(!item.ammo_cells)
55         item.ammo_cells = g_pickup_cells;
56 }
57 #endif
58 REGISTER_ITEM(Cells, Ammo) {
59 #ifdef GAMEQC
60     this.m_model    =   MDL_Cells_ITEM;
61 #endif
62     this.m_name     =   "cells";
63     this.m_icon     =   "ammo_cells";
64 #ifdef SVQC
65     this.m_botvalue =   1500;
66     this.m_itemid   =   IT_CELLS;
67     this.m_iteminit =   ammo_cells_init;
68 #endif
69 }
70
71 #ifdef GAMEQC
72 MODEL(Plasma_ITEM, Item_Model("a_cells.md3"));
73 #endif
74
75 #ifdef SVQC
76 PROPERTY(int, g_pickup_plasma);
77 void ammo_plasma_init(entity item)
78 {
79     if(!item.ammo_plasma)
80         item.ammo_plasma = g_pickup_plasma;
81 }
82 #endif
83 REGISTER_ITEM(Plasma, Ammo) {
84 #ifdef GAMEQC
85     this.m_model    =   MDL_Plasma_ITEM;
86 #endif
87     this.m_name     =   "plasma";
88     this.m_icon     =   "ammo_plasma";
89 #ifdef SVQC
90     this.m_botvalue =   1500;
91     this.m_itemid   =   IT_PLASMA;
92     this.m_iteminit =   ammo_plasma_init;
93 #endif
94 }
95
96 #ifdef GAMEQC
97 MODEL(Rockets_ITEM, Item_Model("a_rockets.md3"));
98 #endif
99
100 #ifdef SVQC
101 PROPERTY(int, g_pickup_rockets);
102 void ammo_rockets_init(entity item)
103 {
104     if(!item.ammo_rockets)
105         item.ammo_rockets = g_pickup_rockets;
106 }
107 #endif
108 REGISTER_ITEM(Rockets, Ammo) {
109 #ifdef GAMEQC
110     this.m_model    =   MDL_Rockets_ITEM;
111 #endif
112     this.m_name     =   "rockets";
113     this.m_icon     =   "ammo_rockets";
114 #ifdef SVQC
115     this.m_botvalue =   1500;
116     this.m_itemid   =   IT_ROCKETS;
117     this.m_iteminit =   ammo_rockets_init;
118 #endif
119 }
120
121 #ifdef GAMEQC
122 MODEL(Shells_ITEM, Item_Model("a_shells.md3"));
123 #endif
124
125 #ifdef SVQC
126 PROPERTY(int, g_pickup_shells);
127 void ammo_shells_init(entity item)
128 {
129     if(!item.ammo_shells)
130         item.ammo_shells = g_pickup_shells;
131 }
132 #endif
133 REGISTER_ITEM(Shells, Ammo) {
134 #ifdef GAMEQC
135     this.m_model    =   MDL_Shells_ITEM;
136 #endif
137     this.m_name     =   "shells";
138     this.m_icon     =   "ammo_shells";
139 #ifdef SVQC
140     this.m_botvalue =   1000;
141     this.m_itemid   =   IT_SHELLS;
142     this.m_iteminit =   ammo_shells_init;
143 #endif
144 }