SERVER: Perform traces before explosives damaging entities or triggering Bouncing Betty

This commit is contained in:
MotoLegacy 2023-11-05 10:28:22 -05:00
parent c8e5a75ed9
commit 5caf23cf4a
2 changed files with 9 additions and 7 deletions

View file

@ -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 = void(entity inflictor, entity attacker, float damage2, float mindamage, float radius) DamgageExplode =
{ {
float final_damage; float final_damage = 0;
entity ent; entity ent;
float multi, r; float multi, r;
@ -617,7 +617,6 @@ void(entity inflictor, entity attacker, float damage2, float mindamage, float ra
final_damage /= radius; final_damage /= radius;
final_damage *= 60; final_damage *= 60;
} }
DamageHandler (ent, ent, final_damage, S_EXPLOSIVE);
} }
// shake the camera on impact // shake the camera on impact
vector distance; vector distance;
@ -724,12 +723,12 @@ 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") { if (final_damage / ent.health > 0.10 && ent.crawling != true && ent.classname != "ai_dog") {
ent.crawling = 2; ent.crawling = 2;
} }
}
if (final_damage > 0) { if (final_damage > 0) {
if (CanDamage (ent, inflictor)) if (CanDamage (ent, inflictor))
DamageHandler (ent, attacker, final_damage, S_EXPLOSIVE); DamageHandler (ent, attacker, final_damage, S_EXPLOSIVE);
} }
}
ent = ent.chain; ent = ent.chain;
} }
}; };

View file

@ -56,6 +56,9 @@ void() Betty_Touch =
// Additional sanity check -- don't activate because of us. // Additional sanity check -- don't activate because of us.
if (other == self.owner || other.solid == SOLID_TRIGGER) if (other == self.owner || other.solid == SOLID_TRIGGER)
return; return;
// Don't activate if our center point can't even reach the enemy
if (!CanDamage(other, self))
return;
// Next step is to rise! // Next step is to rise!
self.think = Betty_Rise; self.think = Betty_Rise;