add the sonar pulse

closes #4729
This commit is contained in:
Matthias Mailänder
2014-06-21 22:23:54 +02:00
parent 5cdf0e6a67
commit 43bca0e73d
2 changed files with 45 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information #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 * 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 * available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information, * as published by the Free Software Foundation. For more information,
@@ -8,10 +8,22 @@
*/ */
#endregion #endregion
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Effects;
using OpenRA.Primitives;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {
public class SonarPulsePowerInfo : SupportPowerInfo 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); } 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); base.Activate(self, order, manager);
// TODO: Reveal submarines var info = Info as SonarPulsePowerInfo;
// Should this play for all players? if (info.SonarActor != null)
Sound.Play("sonpulse.aud"); {
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());
});
}
} }
} }
} }

View File

@@ -151,6 +151,20 @@ camera.paradrop:
Types: Camera Types: Camera
BodyOrientation: BodyOrientation:
SONAR:
Immobile:
OccupiesSpace: false
Health:
HP: 1000
RevealsShroud:
Range: 10c0
ProximityCaptor:
Types: Sonar
BodyOrientation:
DetectCloaked:
Range: 10
CloakTypes: Underwater
FLARE: FLARE:
Immobile: Immobile:
OccupiesSpace: false OccupiesSpace: false
@@ -270,10 +284,9 @@ powerproxy.parabombs:
powerproxy.sonarpulse: powerproxy.sonarpulse:
SonarPulsePower: SonarPulsePower:
Icon: sonar Icon: sonar
Description: Sonar Pulse (Single Use) Description: Sonar Pulse
LongDesc: Reveals all submarines on the map for a \nshort time. LongDesc: Reveals all submarines in the vicinity for a \nshort time.
AllowMultiple: yes ChargeTime: 30
OneShot: yes
EndChargeSound: pulse1.aud EndChargeSound: pulse1.aud
SelectTargetSound: slcttgt1.aud SelectTargetSound: slcttgt1.aud