]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix #2672 "Projectile damage unreliability regarding projectile size and rotation"
authorterencehill <piuntn@gmail.com>
Fri, 18 Mar 2022 07:45:22 +0000 (08:45 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 18 Mar 2022 07:45:22 +0000 (08:45 +0100)
qcsrc/server/damage.qc

index 969423bfb83f8b0e55ae1e6add6f25b5bdebefcc..32620218bca23fa7ed120c187b703e4e4ce9c7dd 100644 (file)
@@ -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);