bfbe02ea699af95787a68e8a1b5de67e75fdb9ae
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator_hook.qc
1 AUTOCVAR(g_grappling_hook, bool, false, _("let players spawn with the grappling hook which allows them to pull themselves up"));
2 #ifdef SVQC
3 REGISTER_MUTATOR(hook, autocvar_g_grappling_hook) {
4     MUTATOR_ONADD {
5         g_grappling_hook = true;
6     }
7     MUTATOR_ONROLLBACK_OR_REMOVE {
8         g_grappling_hook = false;
9     }
10 }
11
12 MUTATOR_HOOKFUNCTION(hook, BuildMutatorsString)
13 {
14     ret_string = strcat(ret_string, ":grappling_hook");
15 }
16
17 MUTATOR_HOOKFUNCTION(hook, BuildMutatorsPrettyString)
18 {
19     ret_string = strcat(ret_string, ", Hook");
20 }
21
22 MUTATOR_HOOKFUNCTION(hook, BuildGameplayTipsString)
23 {
24     ret_string = strcat(ret_string, "\n\n^3grappling hook^8 is enabled, press 'e' to use it\n");
25 }
26
27 MUTATOR_HOOKFUNCTION(hook, PlayerSpawn)
28 {
29     SELFPARAM();
30     self.offhand = OFFHAND_HOOK;
31 }
32
33 MUTATOR_HOOKFUNCTION(hook, FilterItem)
34 {
35     return self.weapon == WEP_HOOK.m_id;
36 }
37
38 MUTATOR_HOOKFUNCTION(hook, SetStartItems)
39 {
40     start_items |= ITEM_JetpackRegen.m_itemid;
41     start_ammo_fuel = max(start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
42     warmup_start_ammo_fuel = max(warmup_start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
43 }
44 #endif