Introduce Weapon.TargetActorCenter and adapt projectiles

This also fixes issues with attackers that don't have their own Attack
trait.
This commit is contained in:
reaperrr
2017-06-18 22:27:27 +02:00
committed by Paul Chote
parent 6b3c04a584
commit edffaa4987
15 changed files with 20 additions and 31 deletions

View File

@@ -21,9 +21,6 @@ namespace OpenRA.Mods.Common.Projectiles
[Desc("Simple, invisible, usually direct-on-target projectile.")]
public class InstantHitInfo : IProjectileInfo, IRulesetLoaded<WeaponInfo>
{
[Desc("Apply warheads directly to center of target actor.")]
public readonly bool TargetCenterPosition = false;
[Desc("Maximum offset at the maximum range.")]
public readonly WDist Inaccuracy = WDist.Zero;
@@ -60,9 +57,9 @@ namespace OpenRA.Mods.Common.Projectiles
this.info = info;
source = args.Source;
if (info.TargetCenterPosition)
if (args.Weapon.TargetActorCenter)
target = args.GuidedTarget;
else if (!info.TargetCenterPosition && info.Inaccuracy.Length > 0)
else if (info.Inaccuracy.Length > 0)
{
var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
var maxOffset = inaccuracy * (args.PassiveTarget - source).Length / args.Weapon.Range.Length;