From d5023e376d9a0652e212a34061bfae251dd9ddd8 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 16 May 2014 17:31:46 +0200 Subject: [PATCH] Fixes units hunting Advanced Comm. Center after being damaged by Ion Cannon. Additionally made weapon, effect animation and effect palette customizable. --- OpenRA.Mods.Cnc/Effects/IonCannon.cs | 14 +++++++++----- OpenRA.Mods.Cnc/IonCannonPower.cs | 8 ++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/OpenRA.Mods.Cnc/Effects/IonCannon.cs b/OpenRA.Mods.Cnc/Effects/IonCannon.cs index 83406fb2b2..b7c66ad98b 100644 --- a/OpenRA.Mods.Cnc/Effects/IonCannon.cs +++ b/OpenRA.Mods.Cnc/Effects/IonCannon.cs @@ -20,13 +20,17 @@ namespace OpenRA.Mods.Cnc.Effects { Target target; Animation anim; - Actor firedBy; + Player firedBy; + string palette; + string weapon; - public IonCannon(Actor firedBy, World world, CPos location) + public IonCannon(Player firedBy, string weapon, World world, CPos location, string effect, string palette) { this.firedBy = firedBy; + this.weapon = weapon; + this.palette = palette; target = Target.FromCell(location); - anim = new Animation("ionsfx"); + anim = new Animation(effect); anim.PlayThen("idle", () => Finish(world)); } @@ -34,13 +38,13 @@ namespace OpenRA.Mods.Cnc.Effects public IEnumerable Render(WorldRenderer wr) { - return anim.Render(target.CenterPosition, wr.Palette("effect")); + return anim.Render(target.CenterPosition, wr.Palette(palette)); } void Finish(World world) { world.AddFrameEndTask(w => w.Remove(this)); - Combat.DoExplosion(firedBy, "IonCannon", target.CenterPosition); + Combat.DoExplosion(firedBy.PlayerActor, weapon, target.CenterPosition); } } } diff --git a/OpenRA.Mods.Cnc/IonCannonPower.cs b/OpenRA.Mods.Cnc/IonCannonPower.cs index bfccab5135..92f25fddd7 100644 --- a/OpenRA.Mods.Cnc/IonCannonPower.cs +++ b/OpenRA.Mods.Cnc/IonCannonPower.cs @@ -21,9 +21,13 @@ namespace OpenRA.Mods.Cnc [ActorReference] [Desc("Actor to spawn when the attack starts")] public readonly string CameraActor = null; - [Desc("Amount of time to keep the camera alive")] public readonly int CameraRemoveDelay = 25; + [Desc("Effect sequence to display")] + public readonly string Effect = "ionsfx"; + public readonly string EffectPalette = "effect"; + [Desc("Which weapon to fire")] + public readonly string Weapon = "IonCannon"; public override object Create(ActorInitializer init) { return new IonCannonPower(init.self, this); } } @@ -46,7 +50,7 @@ namespace OpenRA.Mods.Cnc { var info = Info as IonCannonPowerInfo; Sound.Play(Info.LaunchSound, order.TargetLocation.CenterPosition); - w.Add(new IonCannon(self, w, order.TargetLocation)); + w.Add(new IonCannon(self.Owner, info.Weapon, w, order.TargetLocation, info.Effect, info.EffectPalette)); if (info.CameraActor == null) return;