diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index 420f33d069..ab2c4de4bc 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -39,6 +39,12 @@ namespace OpenRA.GameRules [Desc("The maximum range the weapon can fire.")] public readonly WDist Range = WDist.Zero; + [Desc("First burst is aimed at this offset relative to target position.")] + public readonly WVec FirstBurstTargetOffset = WVec.Zero; + + [Desc("Each burst after the first lands by this offset away from the previous burst.")] + public readonly WVec FollowingBurstTargetOffset = WVec.Zero; + [Desc("The sound played each time the weapon is fired.")] public readonly string[] Report = null; diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index 4dba224224..e5a8e7da0c 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -225,6 +225,23 @@ namespace OpenRA.Mods.Common.Traits Func muzzlePosition = () => self.CenterPosition + MuzzleOffset(self, barrel); var legacyFacing = MuzzleOrientation(self, barrel).Yaw.Angle / 4; + var passiveTarget = Weapon.TargetActorCenter ? target.CenterPosition : target.Positions.PositionClosestTo(muzzlePosition()); + var initialOffset = Weapon.FirstBurstTargetOffset; + if (initialOffset != WVec.Zero) + { + // We want this to match Armament.LocalOffset, so we need to convert it to forward, right, up + initialOffset = new WVec(initialOffset.Y, -initialOffset.X, initialOffset.Z); + passiveTarget += initialOffset.Rotate(WRot.FromFacing(legacyFacing)); + } + + var followingOffset = Weapon.FollowingBurstTargetOffset; + if (followingOffset != WVec.Zero) + { + // We want this to match Armament.LocalOffset, so we need to convert it to forward, right, up + followingOffset = new WVec(followingOffset.Y, -followingOffset.X, followingOffset.Z); + passiveTarget += ((Weapon.Burst - Burst) * followingOffset).Rotate(WRot.FromFacing(legacyFacing)); + } + var args = new ProjectileArgs { Weapon = Weapon, @@ -239,7 +256,7 @@ namespace OpenRA.Mods.Common.Traits Source = muzzlePosition(), CurrentSource = muzzlePosition, SourceActor = self, - PassiveTarget = Weapon.TargetActorCenter ? target.CenterPosition : target.Positions.PositionClosestTo(muzzlePosition()), + PassiveTarget = passiveTarget, GuidedTarget = target };