diff --git a/OpenRA.Mods.Common/Warheads/LeaveSmudgeWarhead.cs b/OpenRA.Mods.Common/Warheads/LeaveSmudgeWarhead.cs index ff9602f0d8..9efb42c749 100644 --- a/OpenRA.Mods.Common/Warheads/LeaveSmudgeWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/LeaveSmudgeWarhead.cs @@ -25,10 +25,19 @@ namespace OpenRA.Mods.Common.Warheads [Desc("Type of smudge to apply to terrain.")] public readonly HashSet SmudgeType = new HashSet(); + [Desc("How close to ground must the impact happen to spawn smudges.")] + public readonly WDist AirThreshold = new WDist(128); + public override void DoImpact(Target target, Actor firedBy, IEnumerable damageModifiers) { var world = firedBy.World; - var targetTile = world.Map.CellContaining(target.CenterPosition); + var pos = target.CenterPosition; + var dat = world.Map.DistanceAboveTerrain(pos); + + if (dat > AirThreshold) + return; + + var targetTile = world.Map.CellContaining(pos); var smudgeLayers = world.WorldActor.TraitsImplementing().ToDictionary(x => x.Info.Type); var minRange = (Size.Length > 1 && Size[1] > 0) ? Size[1] : 0;