]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Apply damage to nearby entities via a radial check, fixes applying through walls Mario/fire_applydamage_radial
authorMario <mario.mario@y7mail.com>
Wed, 7 Aug 2024 03:38:34 +0000 (13:38 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 7 Aug 2024 03:38:34 +0000 (13:38 +1000)
qcsrc/server/damage.qc

index d5a9a20c760d352a7d6631ed2530eba9cf2faad4..0e8ec07468925d3f57ff56f9a05bcb6c1ab0b5b3 100644 (file)
@@ -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);
        }
 }