Prevent recursive RadiusDamage call caused by barrels and nades 1466/head
authorotta8634 <k9wolf@pm.me>
Wed, 12 Feb 2025 10:07:43 +0000 (18:07 +0800)
committerotta8634 <k9wolf@pm.me>
Wed, 12 Feb 2025 10:07:43 +0000 (18:07 +0800)
When exploding a barrel, any nearby nades that cause radius damage (e.g. the explosion of the normal nade, explosion of the monster nade, etc.) would also explode, in the same frame, thus calling RadiusDamage recursively.
Fixed this bug by delaying the nade's radius damage in the same way that radius damage of a weapon projectile (like mortar) is delayed when it's damaged & destroyed, with W_PrepareExplosionByDamage.
Bug discovered by myself, fix suggested by Mario, big thanks as always.

qcsrc/common/mutators/mutator/nades/sv_nades.qc

index 0ca068264f15da713e8c64fbe92a88d82fd5d963..bd5249943391858c51c5265157d92021e7752238 100644 (file)
@@ -243,7 +243,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        if(ITEM_DAMAGE_NEEDKILL(deathtype))
        {
                this.takedamage = DAMAGE_NO;
-               nade_boom(this);
+               W_PrepareExplosionByDamage(this, attacker, nade_boom);
                return;
        }