Xonotic
jetpack.qh
Go to the documentation of this file.
1 #pragma once
2 
3 #ifdef SVQC
4  #include <server/items/items.qh>
5 #endif
6 
7 #include "ammo.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 
29 
31  this.m_canonical_spawnfunc = "item_jetpack";
32 #ifdef GAMEQC
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
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 
88 
89 REGISTER_ITEM(JetpackRegen, JetpackRegen) {
90  this.m_canonical_spawnfunc = "item_fuel_regen";
91 #ifdef GAMEQC
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)
Item is usable during normal gameplay.
Definition: item.qh:98
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
CLASS(Object) Object
Definition: oo.qh:318
SPAWNFUNC_ITEM(item_armor_green, ITEM_ArmorMedium) .float wait
entity() spawn
string netname
Definition: powerups.qc:20
float ammo_pickupevalfunc(entity player, entity item)
Definition: items.qc:821
int m_itemid
Definition: jetpack.qh:11
Definition: pickup.qh:22
float spawnflags
Definition: progsdefs.qc:191
REGISTER_ITEM(Jetpack, Jetpack)
Definition: jetpack.qh:30
Item is is a resource, not a held item.
Definition: item.qh:100
#define MODEL(name, path)
Definition: all.qh:8
#define PROPERTY(type, name)
Definition: misc.qh:36
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
Definition: cl_resources.qc:10
#define ENDCLASS(cname)
Definition: oo.qh:269
string Item_Model(string item_mdl)
Definition: all.qc:8
string m_name
Definition: scores.qh:135