Adapt tracking projectiles to support targeting CenterPosition

Instead of closest targetable position.
This commit is contained in:
reaperrr
2017-06-11 21:51:00 +02:00
committed by abcdefg30
parent da7433a95f
commit 7eab278711
4 changed files with 16 additions and 4 deletions

View File

@@ -137,6 +137,9 @@ namespace OpenRA.Mods.Common.Projectiles
"the missile enters the radius of the current speed around the target.")]
public readonly bool AllowSnapping = false;
[Desc("Ignore any other targetable positions and aim directly at center of target actor.")]
public readonly bool TargetCenterPosition = false;
[Desc("Explodes when inside this proximity radius to target.",
"Note: If this value is lower than the missile speed, this check might",
"not trigger fast enough, causing the missile to fly past the target.")]
@@ -799,7 +802,7 @@ namespace OpenRA.Mods.Common.Projectiles
// Check if target position should be updated (actor visible & locked on)
var newTarPos = targetPosition;
if (args.GuidedTarget.IsValidFor(args.SourceActor) && lockOn)
newTarPos = args.GuidedTarget.Positions.PositionClosestTo(args.Source)
newTarPos = (info.TargetCenterPosition ? args.GuidedTarget.CenterPosition : args.GuidedTarget.Positions.PositionClosestTo(args.Source))
+ new WVec(WDist.Zero, WDist.Zero, info.AirburstAltitude);
// Compute target's predicted velocity vector (assuming uniform circular motion)