From 54b4b1ce8ea6d34f28791d9aab06cea74f61ef18 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 12 Mar 2017 01:50:02 +1000 Subject: [PATCH] Check for damage to the player for removing hooks AFTER damage has been modified by mutators, also make sure the attacker is not null (fixes hook randomly breaking, and allows getting out of lava with hook) --- qcsrc/server/g_damage.qc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 11c339b4d..a8f365cbc 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -631,16 +631,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d damage_attacker = attacker; attacker_save = attacker; - if(IS_PLAYER(targ)) - { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - { - .entity weaponentity = weaponentities[slot]; - if(targ.(weaponentity).hook && targ.(weaponentity).hook.aiment == attacker) - RemoveHook(targ.(weaponentity).hook); - } - } - // special rule: gravity bomb does not hit team mates (other than for disconnecting the hook) if(DEATH_ISWEAPON(deathtype, WEP_HOOK) || DEATH_ISWEAPON(deathtype, WEP_TUBA)) { @@ -743,6 +733,16 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d mirrordamage = M_ARGV(5, float); force = M_ARGV(6, vector); + if(IS_PLAYER(targ) && damage > 0 && attacker) + { + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + if(targ.(weaponentity).hook && targ.(weaponentity).hook.aiment == attacker) + RemoveHook(targ.(weaponentity).hook); + } + } + if(STAT(FROZEN, targ)) if(deathtype != DEATH_HURTTRIGGER.m_id && deathtype != DEATH_TEAMCHANGE.m_id && deathtype != DEATH_AUTOTEAMCHANGE.m_id) { -- 2.39.2