Xonotic
items.qh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <common/items/_mod.qh>
6 
11 
12 #ifdef GAMEQC
13 MODEL(VaporizerCells_ITEM, Item_Model("a_cells.md3"));
14 SOUND(VaporizerCells, Item_Sound("itempickup"));
15 #endif
16 
17 #ifdef SVQC
18 int autocvar_g_instagib_ammo_drop;
19 void ammo_vaporizercells_init(Pickup this, entity item)
20 {
21  if(!GetResource(item, RES_CELLS))
22  SetResourceExplicit(item, RES_CELLS, autocvar_g_instagib_ammo_drop);
23 }
24 #endif
25 REGISTER_ITEM(VaporizerCells, Ammo) {
26  this.m_canonical_spawnfunc = "item_vaporizer_cells";
27 #ifdef GAMEQC
29  this.m_model = MDL_VaporizerCells_ITEM;
30  this.m_sound = SND_VaporizerCells;
31 #endif
32  this.netname = "vaporizer_cells";
33  this.m_name = _("Vaporizer ammo");
34  this.m_icon = "ammo_supercells";
35 #ifdef SVQC
36  this.m_botvalue = 2000;
37  this.m_itemid = IT_RESOURCE;
38  this.m_respawntime = GET(instagib_respawntime_ammo);
39  this.m_respawntimejitter = GET(instagib_respawntimejitter_ammo);
40  this.m_iteminit = ammo_vaporizercells_init;
41 #endif
42 }
43 
44 SPAWNFUNC_ITEM(item_vaporizer_cells, ITEM_VaporizerCells)
45 SPAWNFUNC_ITEM(item_minst_cells, ITEM_VaporizerCells)
46 
47 #ifdef GAMEQC
48 MODEL(ExtraLife_ITEM, Item_Model("g_h100.md3"));
49 SOUND(ExtraLife, Item_Sound("megahealth"));
50 #endif
51 
52 REGISTER_ITEM(ExtraLife, Powerup) {
53  this.m_canonical_spawnfunc = "item_extralife";
54 #ifdef GAMEQC
55  this.m_model = MDL_ExtraLife_ITEM;
56  this.m_sound = SND_ExtraLife;
57 #endif
58  this.netname = "extralife";
59  this.m_name = _("Extra life");
60  this.m_icon = "item_mega_health";
61  this.m_color = '1 0 0';
62  this.m_waypoint = _("Extra life");
63  this.m_waypointblink = 2;
64 #ifdef SVQC
65  this.m_itemid = IT_RESOURCE;
66 #endif
67 }
68 
69 SPAWNFUNC_ITEM(item_extralife, ITEM_ExtraLife)
float instagib_respawntime_ammo
Definition: items.qh:7
Definition: ammo.qh:19
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
Definition: cl_resources.qc:15
SPAWNFUNC_ITEM(item_armor_green, ITEM_ArmorMedium) .float wait
#define GETTER(type, name)
Definition: misc.qh:35
entity() spawn
string netname
Definition: powerups.qc:20
int m_itemid
Definition: jetpack.qh:11
Definition: pickup.qh:22
float spawnflags
Definition: progsdefs.qc:191
string Item_Sound(string it_snd)
Definition: all.qc:18
float instagib_respawntimejitter_ammo
Definition: items.qh:8
#define GET(name)
Definition: misc.qh:34
#define MODEL(name, path)
Definition: all.qh:8
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
Definition: cl_resources.qc:10
REGISTER_ITEM(VaporizerCells, Ammo)
Definition: items.qh:25
string Item_Model(string item_mdl)
Definition: all.qc:8
#define SOUND(name, path)
Definition: all.qh:30
string m_name
Definition: scores.qh:135