From d8165f8a1c40bea757a5c783e778813f6b20e1d9 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 7 Aug 2024 13:38:34 +1000 Subject: [PATCH] Apply damage to nearby entities via a radial check, fixes applying through walls --- qcsrc/server/damage.qc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/qcsrc/server/damage.qc b/qcsrc/server/damage.qc index d5a9a20c7..0e8ec0746 100644 --- a/qcsrc/server/damage.qc +++ b/qcsrc/server/damage.qc @@ -1259,17 +1259,18 @@ void Fire_ApplyDamage(entity e) } e.fire_hitsound = true; - if(!IS_INDEPENDENT_PLAYER(e) && !STAT(FROZEN, e)) + if(IS_INDEPENDENT_PLAYER(e) || STAT(FROZEN, e)) + return; + + for(entity head = WarpZone_FindRadius(0.5 * (e.absmin + e.absmax), 0.5 * vlen(e.absmin - e.absmax), true); head; head = head.chain) { - IL_EACH(g_damagedbycontents, it.damagedbycontents && it != e, - { - if(!IS_DEAD(it) && it.takedamage && !IS_INDEPENDENT_PLAYER(it)) - if(boxesoverlap(e.absmin, e.absmax, it.absmin, it.absmax)) - { - t = autocvar_g_balance_firetransfer_time * (fireendtime - time); - d = autocvar_g_balance_firetransfer_damage * e.fire_damagepersec * t; - Fire_AddDamage(it, o, d, t, DEATH_FIRE.m_id); - } - }); + if(head == e || (IS_PLAYER(head) && SAME_TEAM(head, e))) continue; + if(IS_DEAD(head) || STAT(FROZEN, head)) continue; + if(IS_INDEPENDENT_PLAYER(head)) continue; + if(head.takedamage != DAMAGE_AIM) continue; + + t = autocvar_g_balance_firetransfer_time * (fireendtime - time); + d = autocvar_g_balance_firetransfer_damage * e.fire_damagepersec * t; + Fire_AddDamage(head, o, d, t, DEATH_FIRE.m_id); } } -- 2.39.2