diff --git a/OpenRA.Mods.Cnc/Effects/IonCannon.cs b/OpenRA.Mods.Cnc/Effects/IonCannon.cs index 0beb1c56dd..7dc409787c 100644 --- a/OpenRA.Mods.Cnc/Effects/IonCannon.cs +++ b/OpenRA.Mods.Cnc/Effects/IonCannon.cs @@ -25,17 +25,30 @@ namespace OpenRA.Mods.Cnc.Effects readonly string palette; readonly string weapon; - public IonCannon(Player firedBy, string weapon, World world, CPos location, string effect, string palette) + int weaponDelay; + bool impacted = false; + + public IonCannon(Player firedBy, string weapon, World world, CPos location, string effect, string palette, int delay) { this.firedBy = firedBy; this.weapon = weapon; this.palette = palette; + weaponDelay = delay; target = Target.FromCell(world, location); anim = new Animation(world, effect); anim.PlayThen("idle", () => Finish(world)); } - public void Tick(World world) { anim.Tick(); } + public void Tick(World world) + { + anim.Tick(); + if (!impacted && weaponDelay-- <= 0) + { + var weapon = world.Map.Rules.Weapons[this.weapon.ToLowerInvariant()]; + weapon.Impact(target.CenterPosition, firedBy.PlayerActor, 1f); + impacted = true; + } + } public IEnumerable Render(WorldRenderer wr) { @@ -45,8 +58,6 @@ namespace OpenRA.Mods.Cnc.Effects void Finish(World world) { world.AddFrameEndTask(w => w.Remove(this)); - var weapon = world.Map.Rules.Weapons[this.weapon.ToLowerInvariant()]; - weapon.Impact(target.CenterPosition, firedBy.PlayerActor, 1f); } } } diff --git a/OpenRA.Mods.Cnc/IonCannonPower.cs b/OpenRA.Mods.Cnc/IonCannonPower.cs index 116eb958fd..99da3beead 100644 --- a/OpenRA.Mods.Cnc/IonCannonPower.cs +++ b/OpenRA.Mods.Cnc/IonCannonPower.cs @@ -21,13 +21,19 @@ 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"; + + [Desc("Apply the weapon impact this many ticks into the effect")] + public readonly int WeaponDelay = 7; public override object Create(ActorInitializer init) { return new IonCannonPower(init.self, this); } } @@ -50,7 +56,7 @@ namespace OpenRA.Mods.Cnc { var info = Info as IonCannonPowerInfo; Sound.Play(Info.LaunchSound, self.World.Map.CenterOfCell(order.TargetLocation)); - w.Add(new IonCannon(self.Owner, info.Weapon, w, order.TargetLocation, info.Effect, info.EffectPalette)); + w.Add(new IonCannon(self.Owner, info.Weapon, w, order.TargetLocation, info.Effect, info.EffectPalette, info.WeaponDelay)); if (info.CameraActor == null) return; diff --git a/OpenRA.Mods.RA/Bridge.cs b/OpenRA.Mods.RA/Bridge.cs index 5a066bc9cc..c4a1ec1292 100644 --- a/OpenRA.Mods.RA/Bridge.cs +++ b/OpenRA.Mods.RA/Bridge.cs @@ -37,6 +37,9 @@ namespace OpenRA.Mods.RA public readonly string[] ShorePieces = {"br1", "br2"}; public readonly int[] NorthOffset = null; public readonly int[] SouthOffset = null; + + [Desc("The name of the weapon to use when demolishing the bridge")] + public readonly string DemolishWeapon = "Demolish"; public object Create(ActorInitializer init) { return new Bridge(init.self, this); } @@ -295,7 +298,7 @@ namespace OpenRA.Mods.RA var initialDamage = Health.DamageState; self.World.AddFrameEndTask(w => { - var weapon = saboteur.World.Map.Rules.Weapons["demolish"]; + var weapon = saboteur.World.Map.Rules.Weapons[Info.DemolishWeapon.ToLowerInvariant()]; weapon.Impact(self.CenterPosition, saboteur, 1f); self.World.WorldActor.Trait().AddEffect(15, self.CenterPosition, 6); self.Kill(saboteur);