]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/items/item/jetpack.qh
Reorganise item code so that VM-specific code is in its correct directories and not...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item / jetpack.qh
1 #pragma once
2
3 #ifdef SVQC
4     #include <server/items/items.qh>
5 #endif
6
7 #include "ammo.qh"
8 #include "powerup.qh"
9
10 #ifndef SVQC
11 .int m_itemid;
12 #endif
13
14 #ifdef GAMEQC
15 MODEL(Jetpack_ITEM, Item_Model("g_jetpack.md3"));
16 #endif
17
18 #ifdef SVQC
19 PROPERTY(int, g_pickup_fuel_jetpack);
20 void powerup_jetpack_init(Pickup this, entity item)
21 {
22     if(!GetResource(item, RES_FUEL))
23         SetResourceExplicit(item, RES_FUEL, g_pickup_fuel_jetpack);
24 }
25 #endif
26
27 CLASS(Jetpack, Powerup)
28 ENDCLASS(Jetpack)
29
30 REGISTER_ITEM(Jetpack, Powerup) {
31     this.m_canonical_spawnfunc = "item_jetpack";
32 #ifdef GAMEQC
33         this.spawnflags = ITEM_FLAG_NORMAL;
34     this.m_model                =   MDL_Jetpack_ITEM;
35     this.m_itemid               =   IT_JETPACK;
36 #endif
37     this.netname                =   "jetpack";
38     this.m_name                 =   _("Jetpack");
39     this.m_icon                 =   "jetpack";
40     this.m_color                =   '0.5 0.5 0.5';
41     this.m_waypoint             =   _("Jetpack");
42     this.m_waypointblink        =   2;
43 #ifdef SVQC
44     this.m_botvalue             =   3000;
45     this.m_pickupevalfunc       =   ammo_pickupevalfunc;
46     this.m_iteminit             =   powerup_jetpack_init;
47 #endif
48 }
49
50 SPAWNFUNC_ITEM(item_jetpack, ITEM_Jetpack)
51
52 #ifdef GAMEQC
53 MODEL(JetpackFuel_ITEM, Item_Model("g_fuel.md3"));
54 #endif
55
56 #ifdef SVQC
57 PROPERTY(int, g_pickup_fuel);
58 void ammo_fuel_init(Pickup this, entity item)
59 {
60     if(!GetResource(item, RES_FUEL))
61         SetResourceExplicit(item, RES_FUEL, g_pickup_fuel);
62 }
63 #endif
64 REGISTER_ITEM(JetpackFuel, Ammo) {
65     this.m_canonical_spawnfunc = "item_fuel";
66 #ifdef GAMEQC
67         this.spawnflags = ITEM_FLAG_NORMAL | ITEM_FLAG_RESOURCE;
68     this.m_model    =   MDL_JetpackFuel_ITEM;
69 #endif
70     this.netname    =   "fuel";
71     this.m_name     =   _("fuel");
72     this.m_icon     =   "ammo_fuel";
73 #ifdef SVQC
74     this.m_botvalue =   2000;
75     this.m_itemid   =   IT_RESOURCE;
76     this.m_iteminit =   ammo_fuel_init;
77 #endif
78 }
79
80 SPAWNFUNC_ITEM(item_fuel, ITEM_JetpackFuel)
81
82 #ifdef GAMEQC
83 MODEL(JetpackRegen_ITEM, Item_Model("g_fuelregen.md3"));
84 #endif
85
86 CLASS(JetpackRegen, Powerup)
87 ENDCLASS(JetpackRegen)
88
89 REGISTER_ITEM(JetpackRegen, JetpackRegen) {
90     this.m_canonical_spawnfunc = "item_fuel_regen";
91 #ifdef GAMEQC
92         this.spawnflags = ITEM_FLAG_NORMAL;
93     this.m_model                =   MDL_JetpackRegen_ITEM;
94 #endif
95     this.netname                =   "fuel_regen";
96     this.m_name                 =   _("Fuel regenerator");
97     this.m_icon                 =   "fuelregen";
98     this.m_color                =   '1 0.5 0';
99     this.m_waypoint             =   _("Fuel regen");
100     this.m_waypointblink        =   2;
101 #ifdef SVQC
102     this.m_botvalue             =   3000;
103     this.m_itemid               =   IT_FUEL_REGEN;
104     this.m_pickupevalfunc       =   ammo_pickupevalfunc;
105 #endif
106 }
107
108 SPAWNFUNC_ITEM(item_fuel_regen, ITEM_JetpackRegen)