diff --git a/OpenRA.Mods.RA/SupportPowers/SonarPulsePower.cs b/OpenRA.Mods.RA/SupportPowers/SonarPulsePower.cs index 621ff46278..f484a69261 100755 --- a/OpenRA.Mods.RA/SupportPowers/SonarPulsePower.cs +++ b/OpenRA.Mods.RA/SupportPowers/SonarPulsePower.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 The OpenRA Developers (see AUTHORS) * This file is part of OpenRA, which is free software. It is made * available to you under the terms of the GNU General Public License * as published by the Free Software Foundation. For more information, @@ -8,10 +8,22 @@ */ #endregion +using OpenRA.Mods.RA.Activities; +using OpenRA.Mods.RA.Effects; +using OpenRA.Primitives; + namespace OpenRA.Mods.RA { public class SonarPulsePowerInfo : SupportPowerInfo { + [Desc("Actor to spawn to reveal the submarines")] + public readonly string SonarActor = "sonar"; + + [Desc("Amount of time to keep the actor alive")] + public readonly int SonarDuration = 250; + + public readonly string SonarPing = "sonpulse.aud"; + public override object Create(ActorInitializer init) { return new SonarPulsePower(init.self, this); } } @@ -22,10 +34,22 @@ namespace OpenRA.Mods.RA { base.Activate(self, order, manager); - // TODO: Reveal submarines + var info = Info as SonarPulsePowerInfo; - // Should this play for all players? - Sound.Play("sonpulse.aud"); + if (info.SonarActor != null) + { + self.World.AddFrameEndTask(w => + { + var sonar = w.CreateActor(info.SonarActor, new TypeDictionary + { + new LocationInit(order.TargetLocation), + new OwnerInit(self.Owner), + }); + Sound.Play(info.SonarPing, sonar.CenterPosition); + sonar.QueueActivity(new Wait(info.SonarDuration)); + sonar.QueueActivity(new RemoveSelf()); + }); + } } } } diff --git a/mods/ra/rules/misc.yaml b/mods/ra/rules/misc.yaml index 82abbb1ebe..4018d03757 100644 --- a/mods/ra/rules/misc.yaml +++ b/mods/ra/rules/misc.yaml @@ -151,6 +151,20 @@ camera.paradrop: Types: Camera BodyOrientation: +SONAR: + Immobile: + OccupiesSpace: false + Health: + HP: 1000 + RevealsShroud: + Range: 10c0 + ProximityCaptor: + Types: Sonar + BodyOrientation: + DetectCloaked: + Range: 10 + CloakTypes: Underwater + FLARE: Immobile: OccupiesSpace: false @@ -270,10 +284,9 @@ powerproxy.parabombs: powerproxy.sonarpulse: SonarPulsePower: Icon: sonar - Description: Sonar Pulse (Single Use) - LongDesc: Reveals all submarines on the map for a \nshort time. - AllowMultiple: yes - OneShot: yes + Description: Sonar Pulse + LongDesc: Reveals all submarines in the vicinity for a \nshort time. + ChargeTime: 30 EndChargeSound: pulse1.aud SelectTargetSound: slcttgt1.aud