diff --git a/OpenRA.Mods.RA/Effects/NukeLaunch.cs b/OpenRA.Mods.RA/Effects/NukeLaunch.cs index a65164a256..330d7a3a4c 100755 --- a/OpenRA.Mods.RA/Effects/NukeLaunch.cs +++ b/OpenRA.Mods.RA/Effects/NukeLaunch.cs @@ -17,6 +17,7 @@ namespace OpenRA.Mods.RA.Effects { public class NukeLaunch : IEffect { + readonly Player firedBy; readonly Actor silo; Animation anim; float2 pos; @@ -25,8 +26,9 @@ namespace OpenRA.Mods.RA.Effects bool goingUp = true; string weapon; - public NukeLaunch(Actor silo, string weapon, int2 spawnOffset, int2 targetLocation) + public NukeLaunch(Player firedBy, Actor silo, string weapon, int2 spawnOffset, int2 targetLocation) { + this.firedBy = firedBy; this.silo = silo; this.targetLocation = targetLocation; this.weapon = weapon; @@ -35,8 +37,8 @@ namespace OpenRA.Mods.RA.Effects if (silo == null) { - altitude = silo.World.Map.Bounds.Height*Game.CellSize; - StartDescent(silo.World); + altitude = firedBy.World.Map.Bounds.Height*Game.CellSize; + StartDescent(firedBy.World); } else pos = silo.CenterLocation + spawnOffset; @@ -76,13 +78,14 @@ namespace OpenRA.Mods.RA.Effects void Explode(World world) { world.AddFrameEndTask(w => w.Remove(this)); - Combat.DoExplosion(silo.Owner.PlayerActor, weapon, pos, 0); + Combat.DoExplosion(firedBy.PlayerActor, weapon, pos, 0); world.WorldActor.Trait().AddEffect(20, pos, 5); } public IEnumerable Render() { - yield return new Renderable(anim.Image, pos - 0.5f * anim.Image.size - new float2(0, altitude), "effect", (int)pos.Y); + yield return new Renderable(anim.Image, pos - 0.5f * anim.Image.size - new float2(0, altitude), + "effect", (int)pos.Y); } } } diff --git a/OpenRA.Mods.RA/SupportPowers/NukePower.cs b/OpenRA.Mods.RA/SupportPowers/NukePower.cs index 91eeefcc15..e9eef62c57 100755 --- a/OpenRA.Mods.RA/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.RA/SupportPowers/NukePower.cs @@ -8,10 +8,8 @@ */ #endregion -using System.Linq; using OpenRA.Mods.RA.Effects; using OpenRA.Mods.RA.Render; -using OpenRA.Orders; using OpenRA.Traits; namespace OpenRA.Mods.RA @@ -39,12 +37,13 @@ namespace OpenRA.Mods.RA // Play to everyone but the current player if (self.Owner != self.World.LocalPlayer) Sound.Play(Info.LaunchSound); + + var npi = Info as NukePowerInfo; self.Trait().PlayCustomAnim(self, "active"); - self.World.AddFrameEndTask(w => - { - w.Add(new NukeLaunch(self, (Info as NukePowerInfo).MissileWeapon, (Info as NukePowerInfo).SpawnOffset, order.TargetLocation)); - }); + self.World.AddFrameEndTask(w => w.Add( + new NukeLaunch(self.Owner, self, npi.MissileWeapon, npi.SpawnOffset, + order.TargetLocation))); } } }