From: Mario Date: Sat, 11 Mar 2017 15:50:02 +0000 (+1000) Subject: Check for damage to the player for removing hooks AFTER damage has been modified... X-Git-Tag: xonotic-v0.8.2~74 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=54b4b1ce8ea6d34f28791d9aab06cea74f61ef18;p=xonotic%2Fxonotic-data.pk3dir.git 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) --- 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) {