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