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

@@ -57,6 +57,9 @@ namespace OpenRA.Mods.Common.Projectiles
[Desc("Does the beam follow the target.")]
public readonly bool TrackTarget = false;
[Desc("Ignore any other targetable positions and aim directly at center of target actor.")]
public readonly bool TargetCenterPosition = false;
[Desc("Should the beam be visually rendered? False = Beam is invisible.")]
public readonly bool RenderBeam = true;
@@ -157,7 +160,7 @@ namespace OpenRA.Mods.Common.Projectiles
if (args.GuidedTarget.IsValidFor(args.SourceActor))
{
var guidedTargetPos = args.GuidedTarget.Positions.PositionClosestTo(args.Source);
var guidedTargetPos = info.TargetCenterPosition ? args.GuidedTarget.CenterPosition : args.GuidedTarget.Positions.PositionClosestTo(args.Source);
var targetDistance = new WDist((guidedTargetPos - args.Source).Length);
// Only continue tracking target if it's within weapon range +