From c02206601c413a930f8f768f9557077629fa3ed6 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 1 Jan 2016 15:43:34 +0100 Subject: [PATCH 1/3] Use airMargin in CreateEffectWarhead's water check Closes #10350. --- OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs index 63279db33c..d42fefe38c 100644 --- a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs @@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Warheads if (dat.Length > airMargin.Length) return isDirectHit ? ImpactType.AirHit : ImpactType.Air; - if (dat.Length <= 0 && world.Map.GetTerrainInfo(cell).IsWater) + if (dat.Length <= airMargin.Length && world.Map.GetTerrainInfo(cell).IsWater) return isDirectHit ? ImpactType.WaterHit : ImpactType.Water; if (isDirectHit) From 671f5af7237a8be1f8a93b22c0fe27b4d183543c Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 1 Jan 2016 15:44:07 +0100 Subject: [PATCH 2/3] Unhardcode Missile freefall gravity --- OpenRA.Mods.Common/Effects/Missile.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Effects/Missile.cs b/OpenRA.Mods.Common/Effects/Missile.cs index b671f38c2e..bf9583d2f2 100644 --- a/OpenRA.Mods.Common/Effects/Missile.cs +++ b/OpenRA.Mods.Common/Effects/Missile.cs @@ -76,6 +76,9 @@ namespace OpenRA.Mods.Common.Effects [Desc("Vertical rate of turn.")] public readonly int VerticalRateOfTurn = 6; + [Desc("Gravity applied while in free fall.")] + public readonly int Gravity = 10; + [Desc("Run out of fuel after being activated this many ticks. Zero for unlimited fuel.")] public readonly int RangeLimit = 0; @@ -152,8 +155,7 @@ namespace OpenRA.Mods.Common.Effects readonly ProjectileArgs args; readonly Animation anim; - // NOTE: Might be desirable to unhardcode the number -10 - readonly WVec gravity = new WVec(0, 0, -10); + readonly WVec gravity; int ticks; @@ -191,6 +193,7 @@ namespace OpenRA.Mods.Common.Effects pos = args.Source; hFacing = args.Facing; + gravity = new WVec(0, 0, -info.Gravity); targetPosition = args.PassiveTarget; var world = args.SourceActor.World; From d93a3a61ee8597482b0e4d7fabc3d6f12adce58b Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 1 Jan 2016 15:45:18 +0100 Subject: [PATCH 3/3] Use DistanceFromEdge instead of OuterRadius for CreateEffectWarhead's hit check --- OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs index d42fefe38c..e79d54322a 100644 --- a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs @@ -77,8 +77,8 @@ namespace OpenRA.Mods.Common.Warheads if (healthInfo == null) continue; - // If the impact position is within any actor's health radius, we have a direct hit - if ((unit.CenterPosition - pos).LengthSquared <= healthInfo.Shape.OuterRadius.LengthSquared) + // If the impact position is within any actor's HitShape, we have a direct hit + if ((unit.CenterPosition - pos).LengthSquared <= healthInfo.Shape.DistanceFromEdge(pos, unit).LengthSquared) return true; }