diff --git a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs index 1c7534b8df..6879b3eaf9 100644 --- a/OpenRA.Mods.Common/Projectiles/AreaBeam.cs +++ b/OpenRA.Mods.Common/Projectiles/AreaBeam.cs @@ -157,7 +157,7 @@ namespace OpenRA.Mods.Common.Projectiles if (args.GuidedTarget.IsValidFor(args.SourceActor)) { - var guidedTargetPos = args.GuidedTarget.CenterPosition; + var guidedTargetPos = args.GuidedTarget.Positions.PositionClosestTo(args.Source); var targetDistance = new WDist((guidedTargetPos - args.Source).Length); // Only continue tracking target if it's within weapon range + diff --git a/OpenRA.Mods.Common/Projectiles/InstantHit.cs b/OpenRA.Mods.Common/Projectiles/InstantHit.cs index 797aade389..8c8e837ee2 100644 --- a/OpenRA.Mods.Common/Projectiles/InstantHit.cs +++ b/OpenRA.Mods.Common/Projectiles/InstantHit.cs @@ -21,6 +21,9 @@ namespace OpenRA.Mods.Common.Projectiles [Desc("Simple, invisible, usually direct-on-target projectile.")] public class InstantHitInfo : IProjectileInfo, IRulesetLoaded { + [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; @@ -57,14 +60,16 @@ namespace OpenRA.Mods.Common.Projectiles this.info = info; source = args.Source; - if (info.Inaccuracy.Length > 0) + if (info.TargetCenterPosition) + target = args.GuidedTarget; + else if (!info.TargetCenterPosition && info.Inaccuracy.Length > 0) { var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers); var maxOffset = inaccuracy * (args.PassiveTarget - source).Length / args.Weapon.Range.Length; target = Target.FromPos(args.PassiveTarget + WVec.FromPDF(args.SourceActor.World.SharedRandom, 2) * maxOffset / 1024); } else - target = args.GuidedTarget; + target = Target.FromPos(args.PassiveTarget); } public void Tick(World world) diff --git a/OpenRA.Mods.Common/Projectiles/LaserZap.cs b/OpenRA.Mods.Common/Projectiles/LaserZap.cs index 28da4682b6..c8ec89be47 100644 --- a/OpenRA.Mods.Common/Projectiles/LaserZap.cs +++ b/OpenRA.Mods.Common/Projectiles/LaserZap.cs @@ -128,7 +128,7 @@ namespace OpenRA.Mods.Common.Projectiles { // Beam tracks target if (info.TrackTarget && args.GuidedTarget.IsValidFor(args.SourceActor)) - target = args.GuidedTarget.CenterPosition; + target = args.GuidedTarget.Positions.PositionClosestTo(source); // Check for blocking actors WPos blockedPos; diff --git a/OpenRA.Mods.Common/Projectiles/Missile.cs b/OpenRA.Mods.Common/Projectiles/Missile.cs index 77fd621a5a..2e37c8b432 100644 --- a/OpenRA.Mods.Common/Projectiles/Missile.cs +++ b/OpenRA.Mods.Common/Projectiles/Missile.cs @@ -799,7 +799,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.CenterPosition + newTarPos = args.GuidedTarget.Positions.PositionClosestTo(args.Source) + new WVec(WDist.Zero, WDist.Zero, info.AirburstAltitude); // Compute target's predicted velocity vector (assuming uniform circular motion) diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index 0cee48ad07..ecbbbce541 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -229,7 +229,7 @@ namespace OpenRA.Mods.Common.Traits Source = muzzlePosition(), CurrentSource = muzzlePosition, SourceActor = self, - PassiveTarget = target.CenterPosition, + PassiveTarget = target.Positions.PositionClosestTo(muzzlePosition()), GuidedTarget = target }; diff --git a/mods/ts/weapons/energyweapons.yaml b/mods/ts/weapons/energyweapons.yaml index 5f61791298..a83e7a0fa0 100644 --- a/mods/ts/weapons/energyweapons.yaml +++ b/mods/ts/weapons/energyweapons.yaml @@ -201,6 +201,7 @@ TurretLaserFire: LaserFence: Projectile: InstantHit + TargetCenterPosition: true Warhead@1Dam: TargetDamage DebugOverlayColor: FF0000 Damage: 99999 diff --git a/mods/ts/weapons/healweapons.yaml b/mods/ts/weapons/healweapons.yaml index a6c2057c54..da57d23352 100644 --- a/mods/ts/weapons/healweapons.yaml +++ b/mods/ts/weapons/healweapons.yaml @@ -4,6 +4,7 @@ Report: healer1.aud ValidTargets: Infantry Projectile: InstantHit + TargetCenterPosition: true Warhead@1Dam: TargetDamage DebugOverlayColor: 00FF00 Damage: -50