From 358c9a29ad2c99e1e688a1ff079c11501291ce00 Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 18 Mar 2022 08:45:22 +0100 Subject: [PATCH] Fix #2672 "Projectile damage unreliability regarding projectile size and rotation" --- qcsrc/server/damage.qc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/qcsrc/server/damage.qc b/qcsrc/server/damage.qc index 969423bfb..32620218b 100644 --- a/qcsrc/server/damage.qc +++ b/qcsrc/server/damage.qc @@ -916,10 +916,15 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in vector diff; float power; - // LordHavoc: measure distance to nearest point on target (not origin) - // (this guarentees 100% damage on a touch impact) + // measure distance from nearest point on target (not origin) + // to nearest point on inflictor (not origin) nearest = targ.WarpZone_findradius_nearest; - diff = targ.WarpZone_findradius_dist; + vector inflictornearest = WarpZoneLib_NearestPointOnBox( + inflictororigin - (inflictor.maxs - inflictor.mins) * 0.5, + inflictororigin + (inflictor.maxs - inflictor.mins) * 0.5, + nearest); + diff = inflictornearest - nearest; + // round up a little on the damage to ensure full damage on impacts // and turn the distance into a fraction of the radius power = 1 - ((vlen (diff) - bound(MIN_DAMAGEEXTRARADIUS, targ.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad); -- 2.39.2