set g_playerclip_collisions 1 "0 = disable collision testing against playerclips, might be useful on some defrag maps"
set g_botclip_collisions 1 "0 = disable collision testing against botclips, might be useful on some defrag maps"
-set g_grappling_hook 0 "let players spawn with the grappling hook which allows them to pull themselves up"
-
set g_spawn_alloweffects 1 "allow clients to enable spawn point and event effects such as particles and sounds, see cl_spawn_ cvars for more info"
set g_spawn_furthest 0.5 "this amount of the spawns shall be far away from any players"
set g_spawn_useallspawns 0 "use all spawns, e.g. also team spawns in non-teamplay, and all spawns, even enemy spawns, in teamplay"
#ifdef IMPLEMENTATION
#ifdef SVQC
-void spawnfunc_weapon_hook(void)
-{SELFPARAM();
- if(g_grappling_hook) // offhand hook
- {
- startitem_failed = true;
- remove(self);
- return;
- }
- weapon_defaultspawnfunc(WEP_HOOK.m_id);
-}
+void spawnfunc_weapon_hook() { weapon_defaultspawnfunc(WEP_HOOK.m_id); }
void W_Hook_ExplodeThink(void)
{SELFPARAM();
bool autocvar_g_full_getstatus_responses;
bool autocvar_g_fullbrightitems;
bool autocvar_g_fullbrightplayers;
-#define autocvar_g_grappling_hook cvar("g_grappling_hook")
-int autocvar_g_grappling_hook_tarzan;
int autocvar_g_balance_grapplehook_pull_frozen;
float autocvar_g_balance_grapplehook_nade_time;
bool autocvar_g_balance_grapplehook_gravity;
return true;
}
+int autocvar_g_grappling_hook_tarzan;
+
void GrapplingHookThink()
{SELFPARAM();
float spd, dist, minlength, pullspeed, ropestretch, ropeairfriction, rubberforce, newlength, rubberforce_overstretch;
void _GrapplingHookFrame();
void GrapplingHookFrame()
{SELFPARAM();
- if(g_grappling_hook && timeout_status != TIMEOUT_ACTIVE && self.weapon != WEP_HOOK.m_id && !self.vehicle)
- {
- // offhand hook controls
- if(self.BUTTON_HOOK)
- {
- if (!(self.hook || (self.hook_state & HOOK_WAITING_FOR_RELEASE)) && (time > self.hook_refire))
- {
- self.hook_state |= HOOK_FIRING;
- self.hook_state |= HOOK_WAITING_FOR_RELEASE;
- }
+ if (self.offhand == OFFHAND_HOOK) {
+ if (timeout_status != TIMEOUT_ACTIVE && self.weapon != WEP_HOOK.m_id && !self.vehicle) {
+ // offhand hook controls
+ if (self.BUTTON_HOOK) {
+ if (!(self.hook || (self.hook_state & HOOK_WAITING_FOR_RELEASE)) && (time > self.hook_refire)) {
+ self.hook_state |= HOOK_FIRING;
+ self.hook_state |= HOOK_WAITING_FOR_RELEASE;
+ }
+ } else {
+ self.hook_state |= HOOK_REMOVING;
+ self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
+ }
+
+ self.hook_state &= ~HOOK_RELEASING;
+ if (self.BUTTON_CROUCH && autocvar_g_balance_grapplehook_crouchslide) {
+ self.hook_state &= ~HOOK_PULLING;
+ //self.hook_state |= HOOK_RELEASING;
+ } else {
+ self.hook_state |= HOOK_PULLING;
+ //self.hook_state &= ~HOOK_RELEASING;
+ }
+ }
+ } else {
+ if (self.switchweapon != WEP_HOOK.m_id && !self.vehicle) {
+ if (self.BUTTON_HOOK && !self.hook_switchweapon)
+ W_SwitchWeapon(WEP_HOOK.m_id);
}
- else
- {
+ if (self.weapon != WEP_HOOK.m_id && self.offhand != OFFHAND_HOOK) {
+ self.hook_state &= ~HOOK_FIRING;
self.hook_state |= HOOK_REMOVING;
- self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
- }
-
- self.hook_state &= ~HOOK_RELEASING;
- if(self.BUTTON_CROUCH && autocvar_g_balance_grapplehook_crouchslide)
- {
- self.hook_state &= ~HOOK_PULLING;
- //self.hook_state |= HOOK_RELEASING;
}
- else
- {
- self.hook_state |= HOOK_PULLING;
- //self.hook_state &= ~HOOK_RELEASING;
- }
- }
- else if(!g_grappling_hook && self.switchweapon != WEP_HOOK.m_id && !self.vehicle)
- {
- if(self.BUTTON_HOOK && !self.hook_switchweapon)
- W_SwitchWeapon(WEP_HOOK.m_id);
}
self.hook_switchweapon = self.BUTTON_HOOK;
-
- if(!g_grappling_hook && self.weapon != WEP_HOOK.m_id && self.offhand != OFFHAND_HOOK)
- {
- self.hook_state &= ~HOOK_FIRING;
- self.hook_state |= HOOK_REMOVING;
- }
_GrapplingHookFrame();
}
MUTATOR_CALLHOOK(BuildMutatorsString, s);
s = ret_string;
- // simple, probably not good in the mutator system
- if(autocvar_g_grappling_hook)
- s = strcat(s, ":grappling_hook");
-
// initialiation stuff, not good in the mutator system
if(!autocvar_g_use_ammunition)
s = strcat(s, ":no_use_ammunition");
MUTATOR_CALLHOOK(SetStartItems);
- if ((start_items & ITEM_Jetpack.m_itemid) || (g_grappling_hook && (start_weapons & WEPSET_HOOK)))
+ if (start_items & ITEM_Jetpack.m_itemid)
{
start_items |= ITEM_JetpackRegen.m_itemid;
start_ammo_fuel = max(start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
sv_foginterval = cvar("sv_foginterval");
g_cloaked = cvar("g_cloaked");
g_footsteps = cvar("g_footsteps");
- g_grappling_hook = cvar("g_grappling_hook");
g_jetpack = cvar("g_jetpack");
sv_maxidle = cvar("sv_maxidle");
sv_maxidle_spectatorsareidle = cvar("sv_maxidle_spectatorsareidle");
-REGISTER_MUTATOR(hook, cvar("_g_grappling_hook"));
+AUTOCVAR(g_grappling_hook, bool, _("let players spawn with the grappling hook which allows them to pull themselves up"));
+REGISTER_MUTATOR(hook, autocvar_g_grappling_hook) {
+ MUTATOR_ONADD {
+ g_grappling_hook = true;
+ }
+ MUTATOR_ONROLLBACK_OR_REMOVE {
+ g_grappling_hook = false;
+ }
+}
+
+MUTATOR_HOOKFUNCTION(hook, BuildMutatorsString)
+{
+ ret_string = strcat(ret_string, ":grappling_hook");
+}
+
+MUTATOR_HOOKFUNCTION(hook, BuildMutatorsPrettyString)
+{
+ ret_string = strcat(ret_string, ", Hook");
+}
+
+MUTATOR_HOOKFUNCTION(hook, BuildGameplayTipsString)
+{
+ ret_string = strcat(ret_string, "\n\n^3grappling hook^8 is enabled, press 'e' to use it\n");
+}
MUTATOR_HOOKFUNCTION(hook, PlayerSpawn)
{
SELFPARAM();
self.offhand = OFFHAND_HOOK;
}
+
+MUTATOR_HOOKFUNCTION(hook, FilterItem)
+{
+ return self.weapon == WEP_HOOK.m_id;
+}
+
+MUTATOR_HOOKFUNCTION(hook, SetStartItems)
+{
+ 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"));
+}
return true;
}
+.bool nade_altbutton;
+
void nades_CheckThrow()
{SELFPARAM();
if(!CanThrowNade())
entity held_nade = self.nade;
if (!held_nade)
{
+ self.nade_altbutton = true;
if(time > self.nade_refire)
{
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_NADE_THROW);
}
else
{
+ self.nade_altbutton = false;
if (time >= held_nade.nade_time_primed + 1) {
makevectors(self.v_angle);
float _force = time - held_nade.nade_time_primed;
{SELFPARAM();
if (!IS_PLAYER(self)) { return false; }
+ if (self.nade && self.offhand != OFFHAND_NADE) OFFHAND_NADE.offhand_think(OFFHAND_NADE, self, self.nade_altbutton);
+
if(IS_PLAYER(self))
{
if ( autocvar_g_nades_bonus && autocvar_g_nades )
self.nade_timer = 0;
- self.offhand = OFFHAND_NADE;
+ if (!self.offhand) self.offhand = OFFHAND_NADE;
if(self.nade_spawnloc)
{
modifications = strcat(modifications, ", Low gravity");
if(g_cloaked && !g_cts)
modifications = strcat(modifications, ", Cloaked");
- if(g_grappling_hook)
- modifications = strcat(modifications, ", Hook");
if(g_weapon_stay && !g_cts)
modifications = strcat(modifications, ", Weapons stay");
if(g_jetpack)
if(modifications != "")
s = strcat(s, "^8\nactive modifications: ^3", modifications, "^8\n");
- if (g_grappling_hook)
- s = strcat(s, "\n\n^3grappling hook^8 is enabled, press 'e' to use it\n");
-
if (cvar("g_nades"))
s = strcat(s, "\n\n^3nades^8 are enabled, press 'g' to use them\n");
if(time < self.hasweapon_complain_spam)
complain = 0;
- if(wpn == WEP_HOOK.m_id && !g_grappling_hook && autocvar_g_nades && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn)))
- complain = 0;
+ // ignore hook button when using nades without hook
+ if (autocvar_g_nades && cl.offhand != OFFHAND_HOOK)
+ if (wpn == WEP_HOOK.m_id && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn)))
+ complain = 0;
if(complain)
self.hasweapon_complain_spam = time + 0.2;
v_up = up;
{
- bool key_pressed;
- if (g_grappling_hook || client_hasweapon(self, WEP_HOOK.m_id, false, false) || (weaponsInMap & WEPSET_HOOK))
- key_pressed = self.button16; // if hook is enabled, use an alternate key
- else
- key_pressed = self.BUTTON_HOOK;
-
+ bool key_pressed = self.BUTTON_HOOK;
entity e = self.offhand;
if (e.offhand_think) e.offhand_think(e, self, key_pressed);
}