]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/mutator/hook/sv_hook.qc
overkill: take into account last weapon held when switching while dead
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / hook / sv_hook.qc
1 #include "sv_hook.qh"
2
3 AUTOCVAR(g_grappling_hook, bool, false, _("let players spawn with the grappling hook which allows them to pull themselves up"));
4 #ifdef SVQC
5 REGISTER_MUTATOR(hook, autocvar_g_grappling_hook) {
6     MUTATOR_ONADD {
7         g_grappling_hook = true;
8         WEP_HOOK.ammo_factor = 0;
9     }
10     MUTATOR_ONROLLBACK_OR_REMOVE {
11         g_grappling_hook = false;
12         WEP_HOOK.ammo_factor = 1;
13     }
14
15     return false;
16 }
17
18 MUTATOR_HOOKFUNCTION(hook, BuildMutatorsString)
19 {
20     M_ARGV(0, string) = strcat(M_ARGV(0, string), ":grappling_hook");
21 }
22
23 MUTATOR_HOOKFUNCTION(hook, BuildMutatorsPrettyString)
24 {
25     M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Hook");
26 }
27
28 MUTATOR_HOOKFUNCTION(hook, BuildGameplayTipsString)
29 {
30     M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3grappling hook^8 is enabled, press 'e' to use it\n");
31 }
32
33 MUTATOR_HOOKFUNCTION(hook, PlayerSpawn)
34 {
35     entity player = M_ARGV(0, entity);
36
37     player.offhand = OFFHAND_HOOK;
38 }
39
40 MUTATOR_HOOKFUNCTION(hook, FilterItem)
41 {
42     entity item = M_ARGV(0, entity);
43
44     return item.weapon == WEP_HOOK.m_id;
45 }
46
47 #endif