Added InaccuracyType.Absolute to projectiles
This commit is contained in:
committed by
Matthias Mailänder
parent
a2dbd5e013
commit
134d47e48c
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
|
||||
public readonly WDist Inaccuracy = WDist.Zero;
|
||||
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' and 'PerCellIncrement'.")]
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")]
|
||||
public readonly InaccuracyType InaccuracyType = InaccuracyType.Maximum;
|
||||
|
||||
[Desc("Can this projectile be blocked when hitting actors with an IBlocksProjectiles trait.")]
|
||||
@@ -136,11 +136,19 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
{
|
||||
var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
|
||||
|
||||
int maxOffset;
|
||||
if (info.InaccuracyType == InaccuracyType.Maximum)
|
||||
maxOffset = inaccuracy * (target - source).Length / args.Weapon.Range.Length;
|
||||
else
|
||||
maxOffset = inaccuracy * (target - source).Length / 1024;
|
||||
var maxOffset = 0;
|
||||
switch (info.InaccuracyType)
|
||||
{
|
||||
case InaccuracyType.Maximum:
|
||||
maxOffset = inaccuracy * (target - source).Length / args.Weapon.Range.Length;
|
||||
break;
|
||||
case InaccuracyType.PerCellIncrement:
|
||||
maxOffset = inaccuracy * (target - source).Length / 1024;
|
||||
break;
|
||||
case InaccuracyType.Absolute:
|
||||
maxOffset = inaccuracy;
|
||||
break;
|
||||
}
|
||||
|
||||
target += WVec.FromPDF(args.SourceActor.World.SharedRandom, 2) * maxOffset / 1024;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user