X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Fhook%2Fsv_hook.qc;h=c6a595363c3a272f64b4a4e0f89de37c7e94e9c6;hb=565754a35f9e84a3b8e6eac08635ec27145b369a;hp=b5a196c51131e7103db9f818991857c4eecb7c0f;hpb=f34fd47ee0a7f283ab60592a17399ec5a500416c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mutators/mutator/hook/sv_hook.qc b/qcsrc/common/mutators/mutator/hook/sv_hook.qc index b5a196c51..c6a595363 100644 --- a/qcsrc/common/mutators/mutator/hook/sv_hook.qc +++ b/qcsrc/common/mutators/mutator/hook/sv_hook.qc @@ -1,15 +1,20 @@ #include "sv_hook.qh" -AUTOCVAR(g_grappling_hook, bool, false, _("let players spawn with the grappling hook which allows them to pull themselves up")); +// can't use the autocvar as it doesn't work in the campaign +//AUTOCVAR(g_grappling_hook, bool, false, "let players spawn with the grappling hook which allows them to pull themselves up"); #ifdef SVQC -REGISTER_MUTATOR(hook, autocvar_g_grappling_hook) { +AUTOCVAR(g_grappling_hook_useammo, bool, false, "Use ammunition with the off-hand grappling hook"); + +REGISTER_MUTATOR(hook, expr_evaluate(cvar_string("g_grappling_hook"))) { MUTATOR_ONADD { g_grappling_hook = true; - WEP_HOOK.ammo_factor = 0; + if(!autocvar_g_grappling_hook_useammo) + WEP_HOOK.ammo_factor = 0; } MUTATOR_ONROLLBACK_OR_REMOVE { g_grappling_hook = false; - WEP_HOOK.ammo_factor = 1; + if(!autocvar_g_grappling_hook_useammo) + WEP_HOOK.ammo_factor = 1; // we don't need to change it } return false; @@ -27,7 +32,17 @@ MUTATOR_HOOKFUNCTION(hook, BuildMutatorsPrettyString) MUTATOR_HOOKFUNCTION(hook, BuildGameplayTipsString) { - M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3grappling hook^8 is enabled, press 'e' to use it\n"); + M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3grappling hook^8 is enabled, press 'e' (+hook) to use it\n"); +} + +MUTATOR_HOOKFUNCTION(hook, SetStartItems) +{ + if(autocvar_g_grappling_hook_useammo) + { + start_items |= ITEM_JetpackRegen.m_itemid; + start_ammo_fuel = max(start_ammo_fuel, cvar("g_balance_fuel_rotstable")); + warmup_start_ammo_fuel = max(warmup_start_ammo_fuel, cvar("g_balance_fuel_rotstable")); + } } MUTATOR_HOOKFUNCTION(hook, PlayerSpawn)