diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index e512c8c153..133d35dc47 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -24,6 +24,7 @@ namespace OpenRA.GameRules public int[] RangeModifiers; public int Facing; public WPos Source; + public Func CurrentSource; public Actor SourceActor; public WPos PassiveTarget; public Target GuidedTarget; diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index 4b86abe678..3c64116f34 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -187,7 +187,7 @@ namespace OpenRA.Mods.Common.Traits return null; var barrel = Barrels[Burst % Barrels.Length]; - var muzzlePosition = self.CenterPosition + MuzzleOffset(self, barrel); + Func muzzlePosition = () => self.CenterPosition + MuzzleOffset(self, barrel); var legacyFacing = MuzzleOrientation(self, barrel).Yaw.Angle / 4; var args = new ProjectileArgs @@ -204,7 +204,8 @@ namespace OpenRA.Mods.Common.Traits RangeModifiers = self.TraitsImplementing() .Select(a => a.GetRangeModifier()).ToArray(), - Source = muzzlePosition, + Source = muzzlePosition(), + CurrentSource = muzzlePosition, SourceActor = self, PassiveTarget = target.CenterPosition, GuidedTarget = target diff --git a/OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs b/OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs index f0ea965dd9..b18935a65e 100644 --- a/OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs +++ b/OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs @@ -70,6 +70,7 @@ namespace OpenRA.Mods.Common.Traits .Select(a => a.GetRangeModifier()).ToArray(), Source = self.CenterPosition, + CurrentSource = () => self.CenterPosition, SourceActor = self, PassiveTarget = self.CenterPosition + new WVec(range, 0, 0).Rotate(rotation) }; diff --git a/OpenRA.Mods.D2k/Traits/SpiceBloom.cs b/OpenRA.Mods.D2k/Traits/SpiceBloom.cs index baeb4ae926..07280e08ca 100644 --- a/OpenRA.Mods.D2k/Traits/SpiceBloom.cs +++ b/OpenRA.Mods.D2k/Traits/SpiceBloom.cs @@ -136,6 +136,7 @@ namespace OpenRA.Mods.D2k.Traits .Select(a => a.GetInaccuracyModifier()).ToArray(), Source = self.CenterPosition, + CurrentSource = () => self.CenterPosition, SourceActor = self, PassiveTarget = self.World.Map.CenterOfCell(cell.Value) };