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