Remove some unnecessary item bits, increase maximum items to 32 now that the item...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item / health.qh
1 #pragma once
2
3 #include "pickup.qh"
4 CLASS(Health, Pickup)
5 #ifdef SVQC
6     ATTRIB(Health, m_mins, vector, '-16 -16 0');
7     ATTRIB(Health, m_maxs, vector, '16 16 48');
8     ATTRIB(Health, m_pickupevalfunc, float(entity player, entity item), healtharmor_pickupevalfunc);
9     ATTRIB(Health, m_botvalue, int, 5000);
10 #endif
11 ENDCLASS(Health)
12
13 #ifdef SVQC
14     #include <common/t_items.qh>
15 #endif
16
17 #ifdef GAMEQC
18 MODEL(HealthSmall_ITEM, Item_Model("g_h1.md3"));
19 SOUND(HealthSmall, Item_Sound("minihealth"));
20 #endif
21 #ifdef SVQC
22 PROPERTY(float, g_pickup_healthsmall_anyway);
23 PROPERTY(int, g_pickup_healthsmall);
24 PROPERTY(int, g_pickup_healthsmall_max);
25 void item_healthsmall_init(Pickup this, entity item)
26 {
27     if(!item.max_health)
28         item.max_health = g_pickup_healthsmall_max;
29     if(!GetResource(item, RES_HEALTH))
30         SetResourceExplicit(item, RES_HEALTH, g_pickup_healthsmall);
31 }
32 #endif
33
34 REGISTER_ITEM(HealthSmall, Health) {
35     this.m_canonical_spawnfunc = "item_health_small";
36 #ifdef GAMEQC
37         this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
38     this.m_model                =   MDL_HealthSmall_ITEM;
39     this.m_sound                =   SND_HealthSmall;
40 #endif
41     this.netname                =   "health_small";
42     this.m_name                 =   _("Small health");
43     this.m_icon                 =   "health";
44 #ifdef SVQC
45     this.m_itemid               =   IT_RESOURCE;
46     this.m_respawntime          =   GET(g_pickup_respawntime_short);
47     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
48     this.m_pickupanyway         =   GET(g_pickup_healthsmall_anyway);
49     this.m_iteminit             =   item_healthsmall_init;
50 #endif
51 }
52
53 SPAWNFUNC_ITEM(item_health_small, ITEM_HealthSmall)
54
55 #ifdef GAMEQC
56 MODEL(HealthMedium_ITEM, Item_Model("g_h25.md3"));
57 SOUND(HealthMedium, Item_Sound("mediumhealth"));
58 #endif
59 #ifdef SVQC
60 PROPERTY(float, g_pickup_healthmedium_anyway);
61 PROPERTY(int, g_pickup_healthmedium);
62 PROPERTY(int, g_pickup_healthmedium_max);
63 void item_healthmedium_init(Pickup this, entity item)
64 {
65     if(!item.max_health)
66         item.max_health = g_pickup_healthmedium_max;
67     if(!GetResource(item, RES_HEALTH))
68         SetResourceExplicit(item, RES_HEALTH, g_pickup_healthmedium);
69 }
70 #endif
71
72 REGISTER_ITEM(HealthMedium, Health) {
73     this.m_canonical_spawnfunc = "item_health_medium";
74 #ifdef GAMEQC
75         this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
76     this.m_model                =   MDL_HealthMedium_ITEM;
77     this.m_sound                =   SND_HealthMedium;
78 #endif
79     this.netname                =   "health_medium";
80     this.m_name                 =   _("Medium health");
81     this.m_icon                 =   "health";
82 #ifdef SVQC
83     this.m_itemid               =   IT_RESOURCE;
84     this.m_respawntime          =   GET(g_pickup_respawntime_short);
85     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
86     this.m_pickupanyway         =   GET(g_pickup_healthmedium_anyway);
87     this.m_iteminit             =   item_healthmedium_init;
88 #endif
89 }
90
91 SPAWNFUNC_ITEM(item_health_medium, ITEM_HealthMedium)
92
93 #ifdef GAMEQC
94 MODEL(HealthBig_ITEM, Item_Model("g_h50.md3"));
95 SOUND(HealthBig, Item_Sound("mediumhealth"));
96 #endif
97 #ifdef SVQC
98 PROPERTY(float, g_pickup_healthbig_anyway);
99 PROPERTY(int, g_pickup_healthbig);
100 PROPERTY(int, g_pickup_healthbig_max);
101 void item_healthbig_init(Pickup this, entity item)
102 {
103     if(!item.max_health)
104         item.max_health = g_pickup_healthbig_max;
105     if(!GetResource(item, RES_HEALTH))
106         SetResourceExplicit(item, RES_HEALTH, g_pickup_healthbig);
107 }
108 #endif
109
110 REGISTER_ITEM(HealthBig, Health) {
111     this.m_canonical_spawnfunc = "item_health_big";
112 #ifdef GAMEQC
113         this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
114     this.m_model                =   MDL_HealthBig_ITEM;
115     this.m_sound                =   SND_HealthBig;
116 #endif
117     this.netname                =   "health_big";
118     this.m_name                 =   _("Big health");
119     this.m_icon                 =   "health";
120     this.m_color                =   '1 0 0';
121     this.m_waypoint             =   _("Big health");
122 #ifdef SVQC
123     this.m_itemid               =   IT_RESOURCE;
124     this.m_respawntime          =   GET(g_pickup_respawntime_medium);
125     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_medium);
126     this.m_pickupanyway         =   GET(g_pickup_healthbig_anyway);
127     this.m_iteminit             =   item_healthbig_init;
128 #endif
129 }
130
131 SPAWNFUNC_ITEM(item_health_big, ITEM_HealthBig)
132
133 #ifdef GAMEQC
134 MODEL(HealthMega_ITEM, Item_Model("g_h100.md3"));
135 SOUND(HealthMega, Item_Sound("megahealth"));
136 #endif
137 #ifdef SVQC
138 PROPERTY(float, g_pickup_healthmega_anyway);
139 PROPERTY(int, g_pickup_healthmega);
140 PROPERTY(int, g_pickup_healthmega_max);
141 void item_healthmega_init(Pickup this, entity item)
142 {
143     if(!item.max_health)
144         item.max_health = g_pickup_healthmega_max;
145     if(!GetResource(item, RES_HEALTH))
146         SetResourceExplicit(item, RES_HEALTH, g_pickup_healthmega);
147 }
148 #endif
149
150 REGISTER_ITEM(HealthMega, Health) {
151     this.m_canonical_spawnfunc = "item_health_mega";
152 #ifdef GAMEQC
153     this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
154     this.m_model                =   MDL_HealthMega_ITEM;
155     this.m_sound                =   SND_HealthMega;
156 #endif
157     this.netname                =   "health_mega";
158     this.m_name                 =   _("Mega health");
159     this.m_icon                 =   "item_mega_health";
160     this.m_color                =   '1 0 0';
161     this.m_waypoint             =   _("Mega health");
162     this.m_waypointblink        =   2;
163 #ifdef SVQC
164     this.m_maxs                 =   '16 16 70';
165     this.m_itemid               =   IT_RESOURCE;
166     this.m_respawntime          =   GET(g_pickup_respawntime_long);
167     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
168     this.m_pickupanyway         =   GET(g_pickup_healthmega_anyway);
169     this.m_iteminit             =   item_healthmega_init;
170 #endif
171 }
172
173 SPAWNFUNC_ITEM(item_health_mega, ITEM_HealthMega)