Support 'inaccuracy' on effect warhead
Purely cosmetic, allows to 'fake' slight inaccuracy without affecting game balance on weapons like light machine guns.
This commit is contained in:
@@ -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<TargetableType> TargetTypeAir = new BitSet<TargetableType>("Air");
|
||||
|
||||
/// <summary>Checks if there are any actors at impact position and if the warhead is valid against any of them.</summary>
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user