From 5caf23cf4abafd0aa3f0ab824de0db283842e72b Mon Sep 17 00:00:00 2001 From: MotoLegacy Date: Sun, 5 Nov 2023 10:28:22 -0500 Subject: [PATCH] SERVER: Perform traces before explosives damaging entities or triggering Bouncing Betty --- source/server/damage.qc | 13 ++++++------- source/server/weapons/bouncing_betty.qc | 3 +++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/server/damage.qc b/source/server/damage.qc index f4d9af1..4ad26ed 100644 --- a/source/server/damage.qc +++ b/source/server/damage.qc @@ -577,7 +577,7 @@ float(float min, float max, vector org1, vector org2, float radius) calculate_pr void(entity inflictor, entity attacker, float damage2, float mindamage, float radius) DamgageExplode = { - float final_damage; + float final_damage = 0; entity ent; float multi, r; @@ -617,7 +617,6 @@ void(entity inflictor, entity attacker, float damage2, float mindamage, float ra final_damage /= radius; final_damage *= 60; } - DamageHandler (ent, ent, final_damage, S_EXPLOSIVE); } // shake the camera on impact vector distance; @@ -724,11 +723,11 @@ void(entity inflictor, entity attacker, float damage2, float mindamage, float ra if (final_damage / ent.health > 0.10 && ent.crawling != true && ent.classname != "ai_dog") { ent.crawling = 2; } - - if (final_damage > 0) { - if (CanDamage (ent, inflictor)) - DamageHandler (ent, attacker, final_damage, S_EXPLOSIVE); - } + } + + if (final_damage > 0) { + if (CanDamage (ent, inflictor)) + DamageHandler (ent, attacker, final_damage, S_EXPLOSIVE); } ent = ent.chain; } diff --git a/source/server/weapons/bouncing_betty.qc b/source/server/weapons/bouncing_betty.qc index db590a1..d631a8f 100644 --- a/source/server/weapons/bouncing_betty.qc +++ b/source/server/weapons/bouncing_betty.qc @@ -56,6 +56,9 @@ void() Betty_Touch = // Additional sanity check -- don't activate because of us. if (other == self.owner || other.solid == SOLID_TRIGGER) return; + // Don't activate if our center point can't even reach the enemy + if (!CanDamage(other, self)) + return; // Next step is to rise! self.think = Betty_Rise;