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");
6 AUTOCVAR(g_grappling_hook_useammo, bool, false, "Use ammunition with the off-hand grappling hook");
8 REGISTER_MUTATOR(hook, expr_evaluate(cvar_string("g_grappling_hook"))) {
10 g_grappling_hook = true;
11 if(!autocvar_g_grappling_hook_useammo)
12 WEP_HOOK.ammo_factor = 0;
14 MUTATOR_ONROLLBACK_OR_REMOVE {
15 g_grappling_hook = false;
16 if(!autocvar_g_grappling_hook_useammo)
17 WEP_HOOK.ammo_factor = 1; // we don't need to change it
23 MUTATOR_HOOKFUNCTION(hook, BuildMutatorsString)
25 M_ARGV(0, string) = strcat(M_ARGV(0, string), ":grappling_hook");
28 MUTATOR_HOOKFUNCTION(hook, BuildMutatorsPrettyString)
30 M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Hook");
33 MUTATOR_HOOKFUNCTION(hook, BuildGameplayTipsString)
35 M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3grappling hook^8 is enabled, press 'e' to use it\n");
38 MUTATOR_HOOKFUNCTION(hook, SetStartItems)
40 if(autocvar_g_grappling_hook_useammo)
42 start_items |= ITEM_JetpackRegen.m_itemid;
43 start_ammo_fuel = max(start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
44 warmup_start_ammo_fuel = max(warmup_start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
48 MUTATOR_HOOKFUNCTION(hook, PlayerSpawn)
50 entity player = M_ARGV(0, entity);
52 player.offhand = OFFHAND_HOOK;
55 MUTATOR_HOOKFUNCTION(hook, FilterItem)
57 entity item = M_ARGV(0, entity);
59 return item.weapon == WEP_HOOK.m_id;