diff --git a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs index 9ae73da2a1..be36eb1d70 100644 --- a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs @@ -46,6 +46,9 @@ namespace OpenRA.Mods.Common.Warheads [Desc("Whether to consider actors in determining whether the explosion should happen. If false, only terrain will be considered.")] public readonly bool ImpactActors = true; + [Desc("The maximum inaccuracy of the effect spawn position relative to actual impact position.")] + public readonly WDist Inaccuracy = WDist.Zero; + static readonly BitSet TargetTypeAir = new BitSet("Air"); /// Checks if there are any actors at impact position and if the warhead is valid against any of them. @@ -109,6 +112,9 @@ namespace OpenRA.Mods.Common.Warheads var explosion = Explosions.RandomOrDefault(world.LocalRandom); if (Image != null && explosion != null) { + if (Inaccuracy.Length > 0) + pos += WVec.FromPDF(world.SharedRandom, 2) * Inaccuracy.Length / 1024; + if (ForceDisplayAtGroundLevel) { var dat = world.Map.DistanceAboveTerrain(pos);