Skip to content

Commit

Permalink
Merge pull request #2847 from CombatExtended-Continued/VPE_Shield_Out…
Browse files Browse the repository at this point in the history
…going_Interception

Vpe shield outgoing interception
  • Loading branch information
N7Huntsman authored Oct 29, 2023
2 parents 5c5ef2c + 29af183 commit 7dd2665
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Source/CombatExtended/Compatibility/VanillaPsycastExpanded.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ public static bool AOE_CheckIntercept(ProjectileCE projectile, Vector3 from, Vec
.SelectMany(x => x.health.hediffSet.hediffs)
.Where(x => x is Hediff_Overshield && x.GetType() != typeof(Hediff_Overshield)).Cast<Hediff_Overshield>())
{
Vector3 shieldPosition = interceptor.pawn.Position.ToVector3ShiftedWithAltitude(0.5f);
Vector3 shieldPosition = interceptor.pawn.Position.ToVector3Shifted().Yto0();
float radius = interceptor.OverlaySize;
float blockRadius = radius + def.projectile.SpeedTilesPerTick + 0.1f;
if (CE_Utility.IntersectionPoint(from, newExactPos, shieldPosition, radius, out Vector3[] sect))
if ((new Vector3(projectile.origin.x, 0, projectile.origin.y) - shieldPosition).sqrMagnitude < radius * radius) // Ensure the shield does not block outgoing projectiles
{
return false;
}
if (CE_Utility.IntersectionPoint(from.Yto0(), newExactPos.Yto0(), shieldPosition, radius, out Vector3[] sect))
{
OnIntercepted(interceptor, projectile, sect);
return true;
Expand Down

0 comments on commit 7dd2665

Please sign in to comment.