Skip to content

Commit

Permalink
Fix high-shields not intercepting indirect fire shells
Browse files Browse the repository at this point in the history
#2869 adjusted the collision check
used by shields to normalize away the 3D component of positions by default, which in turn
caused high-shields to no longer intercept indirect fire shells. Switch these to use spherical
collision checking to bring back the old behavior.
  • Loading branch information
mszabo-wikia committed Oct 27, 2024
1 parent a00dab8 commit e75881e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Source/CombatExtended/CombatExtended/Projectiles/ProjectileCE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,17 @@ protected bool CheckIntercept(Thing interceptorThing, CompProjectileInterceptor
{
return false;
}
if (CE_Utility.IntersectionPoint(LastPos, newExactPos, shieldPosition, radius, out Vector3[] sect))
if (CE_Utility.IntersectionPoint(
LastPos,
newExactPos,
shieldPosition,
radius,
out Vector3[] sect,
// Don't normalize away the 3D component of the projectile position when checking for collisions
// between indirect fire projectiles and shields that protect against them
// (e.g. mortar shells targeting a high-shield).
spherical: interceptorComp.Props.interceptAirProjectiles && def.projectile.flyOverhead
))
{
ExactPosition = newExactPos = sect.OrderBy(x => (OriginIV3.ToVector3() - x).sqrMagnitude).First();
landed = true;
Expand Down

0 comments on commit e75881e

Please sign in to comment.