]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/weapons/weapon/hook.qh
Merge branch 'master' into Mario/qc_camstuff
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / hook.qh
1 #pragma once
2
3 CLASS(Hook, Weapon)
4 /* spawnfunc */ ATTRIB(Hook, m_canonical_spawnfunc, string, "weapon_hook");
5 /* ammotype  */ ATTRIB(Hook, ammo_type, int, RES_FUEL);
6 /* impulse   */ ATTRIB(Hook, impulse, int, 0);
7 /* flags     */ ATTRIB(Hook, spawnflags, int, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
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 #endif
14 /* crosshair */ ATTRIB(Hook, w_crosshair, string, "gfx/crosshairhook");
15 /* crosshair */ ATTRIB(Hook, w_crosshair_size, float, 0.5);
16 /* wepimg    */ ATTRIB(Hook, model2, string, "weaponhook");
17 /* refname   */ ATTRIB(Hook, netname, string, "hook");
18 /* wepname   */ ATTRIB(Hook, m_name, string, _("Grappling Hook"));
19         ATTRIB(Hook, ammo_factor, float, 1);
20
21 #define X(BEGIN, P, END, class, prefix) \
22         BEGIN(class) \
23                 P(class, prefix, ammo, float, PRI) \
24                 P(class, prefix, animtime, float, BOTH) \
25                 P(class, prefix, damageforcescale, float, SEC) \
26                 P(class, prefix, damage, float, SEC) \
27                 P(class, prefix, duration, float, SEC) \
28                 P(class, prefix, edgedamage, float, SEC) \
29                 P(class, prefix, force, float, SEC) \
30                 P(class, prefix, gravity, float, SEC) \
31                 P(class, prefix, health, float, SEC) \
32                 P(class, prefix, hooked_ammo, float, PRI) \
33                 P(class, prefix, hooked_time_free, float, PRI) \
34                 P(class, prefix, hooked_time_max, float, PRI) \
35                 P(class, prefix, lifetime, float, SEC) \
36                 P(class, prefix, power, float, SEC) \
37                 P(class, prefix, radius, float, SEC) \
38                 P(class, prefix, refire, float, BOTH) \
39                 P(class, prefix, speed, float, SEC) \
40         P(class, prefix, switchdelay_drop, float, NONE) \
41                 P(class, prefix, switchdelay_raise, float, NONE) \
42         P(class, prefix, weaponreplace, string, NONE) \
43         P(class, prefix, weaponstartoverride, float, NONE) \
44         P(class, prefix, weaponstart, float, NONE) \
45         P(class, prefix, weaponthrowable, float, NONE) \
46         END()
47     W_PROPS(X, Hook, hook)
48 #undef X
49
50 ENDCLASS(Hook)
51 REGISTER_WEAPON(HOOK, hook, NEW(Hook));
52
53 SPAWNFUNC_WEAPON(weapon_hook, WEP_HOOK)
54
55 CLASS(OffhandHook, OffhandWeapon)
56 #ifdef SVQC
57     METHOD(OffhandHook, offhand_think, void(OffhandHook this, entity actor, bool key_pressed))
58     {
59         Weapon wep = WEP_HOOK;
60         .entity weaponentity = weaponentities[1];
61         wep.wr_think(wep, actor, weaponentity, key_pressed ? 1 : 0);
62     }
63 #endif
64 ENDCLASS(OffhandHook)
65 OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); }
66
67 #ifdef SVQC
68
69 .float dmg;
70 .float dmg_edge;
71 .float dmg_radius;
72 .float dmg_force;
73 .float dmg_power;
74 .float dmg_duration;
75 .float dmg_last;
76 .float hook_refire;
77 .float hook_time_hooked;
78 .float hook_time_fueldecrease;
79 #endif