]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/items/item/pickup.qh
Use the new item system for health and armor
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item / pickup.qh
1 #ifndef PICKUP_H
2 #define PICKUP_H
3 #include "../item.qh"
4 CLASS(Pickup, GameItem)
5     METHOD(Pickup, respondTo, bool(entity, int))
6     ATTRIB(Pickup, m_model, string, string_null)
7     ATTRIB(Pickup, m_sound, string, string_null)
8     ATTRIB(Pickup, m_respawntime, int, 0)
9     ATTRIB(Pickup, m_respawntimejitter, int, 0)
10     ATTRIB(Pickup, m_name, string, string_null)
11     ATTRIB(Pickup, m_itemid, int, 0)
12     ATTRIB(Pickup, m_botvalue, int, 0)
13 ENDCLASS(Pickup)
14
15 #define SPAWNTIMES(_) \
16     _(WEAPON, weapon) \
17     _(AMMO, ammo) \
18     _(SHORT, short) \
19     _(MEDIUM, medium) \
20     _(LONG, long) \
21     /**/
22
23 #define SPAWNTIMES_ENUM(id, idlc) SPAWNTIME_##id ,
24 enum { SPAWNTIMES(SPAWNTIMES_ENUM) };
25 #undef SPAWNTIMES_ENUM
26
27 #ifdef SVQC
28 #include "../../../server/defs.qh"
29
30 #define SPAWNTIMES_MAP(id, idlc) i == SPAWNTIME_##id ? g_pickup_respawntime_##idlc :
31 [[inline]] int spawntime(int i) { return SPAWNTIMES(SPAWNTIMES_MAP) 0; }
32 #undef SPAWNTIMES_MAP
33
34 #define SPAWNTIMES_MAP(id, idlc) i == SPAWNTIME_##id ? g_pickup_respawntimejitter_##idlc :
35 [[inline]] int spawntimejitter(int i) { return SPAWNTIMES(SPAWNTIMES_MAP) 0; }
36 #undef SPAWNTIMES_MAP
37 #endif
38
39 bool Pickup_respondTo(entity this, int request)
40 {
41     switch (request) {
42         default: return false;
43         case ITEM_SIGNAL(Default):
44             print(strcat(this.m_name, " responding\n"));
45             return true;
46     }
47 }
48
49 #endif