From: terencehill Date: Fri, 18 Mar 2022 07:45:22 +0000 (+0100) Subject: Fix #2672 "Projectile damage unreliability regarding projectile size and rotation" X-Git-Tag: xonotic-v0.8.5~145^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=358c9a29ad2c99e1e688a1ff079c11501291ce00;p=xonotic%2Fxonotic-data.pk3dir.git Fix #2672 "Projectile damage unreliability regarding projectile size and rotation" --- 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);