Xonotic
hook.qh
Go to the documentation of this file.
1 #pragma once
2 
4 /* spawnfunc */ ATTRIB(Hook, m_canonical_spawnfunc, string, "weapon_hook");
5 /* ammotype */ ATTRIB(Hook, ammo_type, Resource, RES_FUEL);
6 /* impulse */ ATTRIB(Hook, impulse, int, 0);
8 /* rating */ ATTRIB(Hook, bot_pickupbasevalue, float, 0);
9 /* color */ ATTRIB(Hook, wpcolor, vector, '0 0.5 0');
10 /* modelname */ ATTRIB(Hook, mdl, string, "hookgun");
11 #ifdef GAMEQC
12 /* model */ ATTRIB(Hook, m_model, Model, MDL_HOOK_ITEM);
13 /* flash mdl */ ATTRIB(Hook, m_muzzlemodel, Model, MDL_Null);
14 /* flash eff */ ATTRIB(Hook, m_muzzleeffect, entity, EFFECT_HOOK_MUZZLEFLASH);
15 #endif
16 /* crosshair */ ATTRIB(Hook, w_crosshair, string, "gfx/crosshairhook");
17 /* crosshair */ ATTRIB(Hook, w_crosshair_size, float, 0.5);
18 /* wepimg */ ATTRIB(Hook, model2, string, "weaponhook");
19 /* refname */ ATTRIB(Hook, netname, string, "hook");
20 /* wepname */ ATTRIB(Hook, m_name, string, _("Grappling Hook"));
21  ATTRIB(Hook, ammo_factor, float, 1);
22 
23 #define X(BEGIN, P, END, class, prefix) \
24  BEGIN(class) \
25  P(class, prefix, ammo, float, PRI) \
26  P(class, prefix, animtime, float, BOTH) \
27  P(class, prefix, damageforcescale, float, SEC) \
28  P(class, prefix, damage, float, SEC) \
29  P(class, prefix, duration, float, SEC) \
30  P(class, prefix, edgedamage, float, SEC) \
31  P(class, prefix, force, float, SEC) \
32  P(class, prefix, gravity, float, SEC) \
33  P(class, prefix, health, float, SEC) \
34  P(class, prefix, hooked_ammo, float, PRI) \
35  P(class, prefix, hooked_time_free, float, PRI) \
36  P(class, prefix, hooked_time_max, float, PRI) \
37  P(class, prefix, lifetime, float, SEC) \
38  P(class, prefix, power, float, SEC) \
39  P(class, prefix, radius, float, SEC) \
40  P(class, prefix, refire, float, BOTH) \
41  P(class, prefix, speed, float, SEC) \
42  P(class, prefix, switchdelay_drop, float, NONE) \
43  P(class, prefix, switchdelay_raise, float, NONE) \
44  P(class, prefix, weaponreplace, string, NONE) \
45  P(class, prefix, weaponstartoverride, float, NONE) \
46  P(class, prefix, weaponstart, float, NONE) \
47  P(class, prefix, weaponthrowable, float, NONE) \
48  END()
49  W_PROPS(X, Hook, hook)
50 #undef X
51 
52 ENDCLASS(Hook)
53 REGISTER_WEAPON(HOOK, hook, NEW(Hook));
54 
55 SPAWNFUNC_WEAPON(weapon_hook, WEP_HOOK)
56 
58 #ifdef SVQC
59  METHOD(OffhandHook, offhand_think, void(OffhandHook this, entity actor, bool key_pressed))
60  {
61  Weapon wep = WEP_HOOK;
62  .entity weaponentity = weaponentities[1];
63  wep.wr_think(wep, actor, weaponentity, key_pressed ? 1 : 0);
64  }
65 #endif
66 ENDCLASS(OffhandHook)
67 OffhandHook OFFHAND_HOOK;
68 STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); }
69 
70 #ifdef SVQC
71 
72 .float dmg;
73 .float dmg_edge;
74 .float dmg_radius;
75 .float dmg_force;
76 .float dmg_power;
77 .float dmg_duration;
78 .float dmg_last;
79 .float hook_refire;
80 .float hook_time_hooked;
81 .float hook_time_fueldecrease;
82 #endif
#define X(BEGIN, P, END, class, prefix)
Definition: hook.qh:23
OffhandHook OFFHAND_HOOK
Definition: hook.qh:67
REGISTER_WEAPON(HOOK, hook, NEW(Hook))
float dmg_radius
Definition: damage.qh:40
entity hook
Definition: hook.qh:19
#define NEW(cname,...)
Definition: oo.qh:105
CLASS(Object) Object
Definition: oo.qh:318
entity() spawn
string netname
Definition: powerups.qc:20
float dmg
Definition: platforms.qh:6
float bot_pickupbasevalue
Definition: bot.qh:66
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
const int WEP_TYPE_SPLASH
Definition: weapon.qh:196
float impulse
Definition: progsdefs.qc:158
float spawnflags
Definition: progsdefs.qc:191
#define ATTRIB(...)
Definition: oo.qh:136
STATIC_INIT(OFFHAND_HOOK)
Definition: hook.qh:68
float dmg_edge
Definition: damage.qh:38
float dmg_force
Definition: damage.qh:39
Definition: model.qh:3
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const int WEP_FLAG_CANCLIMB
Definition: weapon.qh:198
#define SPAWNFUNC_WEAPON(name, weapon)
Definition: weapon.qh:143
#define ENDCLASS(cname)
Definition: oo.qh:269
const int WEP_FLAG_NOTRUEAIM
Definition: weapon.qh:210
entity weaponentities[MAX_WEAPONSLOTS]
Definition: weapon.qh:14
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition: weapon.qh:41
#define W_PROPS(L, class, prefix)
Definition: all.qh:163
Definition: hook.qh:3
string m_name
Definition: scores.qh:135