Merge pull request #5698 from Mailaender/sonar
Added the sonar pulse to reveal sub marines
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2013 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,
|
||||||
@@ -13,15 +13,17 @@ using OpenRA.Graphics;
|
|||||||
|
|
||||||
namespace OpenRA.Effects
|
namespace OpenRA.Effects
|
||||||
{
|
{
|
||||||
public class MoveFlash : IEffect
|
public class SpriteEffect : IEffect
|
||||||
{
|
{
|
||||||
|
string palette;
|
||||||
Animation anim;
|
Animation anim;
|
||||||
WPos pos;
|
WPos pos;
|
||||||
|
|
||||||
public MoveFlash(WPos pos, World world)
|
public SpriteEffect(WPos pos, World world, string sprite, string palette)
|
||||||
{
|
{
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
anim = new Animation(world, "moveflsh");
|
this.palette = palette;
|
||||||
|
anim = new Animation(world, sprite);
|
||||||
anim.PlayThen("idle", () => world.AddFrameEndTask(w => w.Remove(this)));
|
anim.PlayThen("idle", () => world.AddFrameEndTask(w => w.Remove(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +34,7 @@ namespace OpenRA.Effects
|
|||||||
|
|
||||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
return anim.Render(pos, WVec.Zero, 0, wr.Palette("moveflash"), 1f / wr.Viewport.Zoom);
|
return anim.Render(pos, WVec.Zero, 0, wr.Palette(palette), 1f / wr.Viewport.Zoom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,6 @@
|
|||||||
<Compile Include="Traits\World\ScreenMap.cs" />
|
<Compile Include="Traits\World\ScreenMap.cs" />
|
||||||
<Compile Include="Traits\World\ActorMap.cs" />
|
<Compile Include="Traits\World\ActorMap.cs" />
|
||||||
<Compile Include="Widgets\HotkeyEntryWidget.cs" />
|
<Compile Include="Widgets\HotkeyEntryWidget.cs" />
|
||||||
<Compile Include="Effects\MoveFlash.cs" />
|
|
||||||
<Compile Include="Widgets\SpriteWidget.cs" />
|
<Compile Include="Widgets\SpriteWidget.cs" />
|
||||||
<Compile Include="Widgets\SpriteSequenceWidget.cs" />
|
<Compile Include="Widgets\SpriteSequenceWidget.cs" />
|
||||||
<Compile Include="Widgets\RGBASpriteWidget.cs" />
|
<Compile Include="Widgets\RGBASpriteWidget.cs" />
|
||||||
@@ -243,6 +242,7 @@
|
|||||||
<Compile Include="Sound\SoundDevice.cs" />
|
<Compile Include="Sound\SoundDevice.cs" />
|
||||||
<Compile Include="Sound\OpenAlSound.cs" />
|
<Compile Include="Sound\OpenAlSound.cs" />
|
||||||
<Compile Include="Sound\NullSound.cs" />
|
<Compile Include="Sound\NullSound.cs" />
|
||||||
|
<Compile Include="Effects\SpriteEffect.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="FileSystem\D2kSoundResources.cs" />
|
<Compile Include="FileSystem\D2kSoundResources.cs" />
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ namespace OpenRA.Widgets
|
|||||||
}
|
}
|
||||||
else if (o.TargetLocation != CPos.Zero)
|
else if (o.TargetLocation != CPos.Zero)
|
||||||
{
|
{
|
||||||
world.AddFrameEndTask(w => w.Add(new MoveFlash(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world)));
|
world.AddFrameEndTask(w => w.Add(new SpriteEffect(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world, "moveflsh", "moveflash")));
|
||||||
flashed = true;
|
flashed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,7 +351,6 @@
|
|||||||
<Compile Include="SupportPowers\IronCurtainPower.cs" />
|
<Compile Include="SupportPowers\IronCurtainPower.cs" />
|
||||||
<Compile Include="SupportPowers\NukePower.cs" />
|
<Compile Include="SupportPowers\NukePower.cs" />
|
||||||
<Compile Include="SupportPowers\ParatroopersPower.cs" />
|
<Compile Include="SupportPowers\ParatroopersPower.cs" />
|
||||||
<Compile Include="SupportPowers\SonarPulsePower.cs" />
|
|
||||||
<Compile Include="SupportPowers\SupportPower.cs" />
|
<Compile Include="SupportPowers\SupportPower.cs" />
|
||||||
<Compile Include="SupportPowers\SupportPowerChargeBar.cs" />
|
<Compile Include="SupportPowers\SupportPowerChargeBar.cs" />
|
||||||
<Compile Include="SupportPowers\SupportPowerManager.cs" />
|
<Compile Include="SupportPowers\SupportPowerManager.cs" />
|
||||||
@@ -520,6 +519,7 @@
|
|||||||
<Compile Include="Widgets\Logic\InstallFromCDLogic.cs" />
|
<Compile Include="Widgets\Logic\InstallFromCDLogic.cs" />
|
||||||
<Compile Include="Widgets\Logic\InstallMusicLogic.cs" />
|
<Compile Include="Widgets\Logic\InstallMusicLogic.cs" />
|
||||||
<Compile Include="Render\WithActiveAnimation.cs" />
|
<Compile Include="Render\WithActiveAnimation.cs" />
|
||||||
|
<Compile Include="SupportPowers\SpawnActorPower.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
|
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2011 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,
|
|
||||||
* see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
|
||||||
{
|
|
||||||
public class SonarPulsePowerInfo : SupportPowerInfo
|
|
||||||
{
|
|
||||||
public override object Create(ActorInitializer init) { return new SonarPulsePower(init.self, this); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SonarPulsePower : SupportPower
|
|
||||||
{
|
|
||||||
public SonarPulsePower(Actor self, SonarPulsePowerInfo info) : base(self, info) { }
|
|
||||||
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
|
||||||
{
|
|
||||||
base.Activate(self, order, manager);
|
|
||||||
|
|
||||||
// TODO: Reveal submarines
|
|
||||||
|
|
||||||
// Should this play for all players?
|
|
||||||
Sound.Play("sonpulse.aud");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
67
OpenRA.Mods.RA/SupportPowers/SpawnActorPower.cs
Executable file
67
OpenRA.Mods.RA/SupportPowers/SpawnActorPower.cs
Executable file
@@ -0,0 +1,67 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* 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,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Effects;
|
||||||
|
using OpenRA.Mods.RA.Activities;
|
||||||
|
using OpenRA.Mods.RA.Effects;
|
||||||
|
using OpenRA.Primitives;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
[Desc("Spawns an actor that stays for a limited amount of time.")]
|
||||||
|
public class SpawnActorPowerInfo : SupportPowerInfo
|
||||||
|
{
|
||||||
|
[Desc("Actor to spawn.")]
|
||||||
|
public readonly string Actor = null;
|
||||||
|
|
||||||
|
[Desc("Amount of time to keep the actor alive in ticks.")]
|
||||||
|
public readonly int LifeTime = 250;
|
||||||
|
|
||||||
|
public readonly string DeploySound = null;
|
||||||
|
|
||||||
|
public readonly string EffectSequence = null;
|
||||||
|
public readonly string EffectPalette = null;
|
||||||
|
|
||||||
|
public override object Create(ActorInitializer init) { return new SpawnActorPower(init.self, this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SpawnActorPower : SupportPower
|
||||||
|
{
|
||||||
|
public SpawnActorPower(Actor self, SpawnActorPowerInfo info) : base(self, info) { }
|
||||||
|
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||||
|
{
|
||||||
|
base.Activate(self, order, manager);
|
||||||
|
|
||||||
|
var info = Info as SpawnActorPowerInfo;
|
||||||
|
|
||||||
|
if (info.Actor != null)
|
||||||
|
{
|
||||||
|
self.World.AddFrameEndTask(w =>
|
||||||
|
{
|
||||||
|
var location = self.World.Map.CenterOfCell(order.TargetLocation);
|
||||||
|
|
||||||
|
Sound.Play(info.DeploySound, location);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(info.EffectSequence) && !string.IsNullOrEmpty(info.EffectPalette))
|
||||||
|
w.Add(new SpriteEffect(location, w, info.EffectSequence, info.EffectPalette));
|
||||||
|
|
||||||
|
var actor = w.CreateActor(info.Actor, new TypeDictionary
|
||||||
|
{
|
||||||
|
new LocationInit(order.TargetLocation),
|
||||||
|
new OwnerInit(self.Owner),
|
||||||
|
});
|
||||||
|
|
||||||
|
actor.QueueActivity(new Wait(info.LifeTime));
|
||||||
|
actor.QueueActivity(new RemoveSelf());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -282,6 +282,13 @@ namespace OpenRA.Utility
|
|||||||
node.Key = "ParachuteSequence";
|
node.Key = "ParachuteSequence";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SonarPulsePower was implemented as a generic SpawnActorPower
|
||||||
|
if (engineVersion < 20140703)
|
||||||
|
{
|
||||||
|
if (depth == 1 && node.Key == "SonarPulsePower")
|
||||||
|
node.Key = "SpawnActorPower";
|
||||||
|
}
|
||||||
|
|
||||||
if (engineVersion < 20140707)
|
if (engineVersion < 20140707)
|
||||||
{
|
{
|
||||||
// SpyPlanePower was removed (use AirstrikePower instead)
|
// SpyPlanePower was removed (use AirstrikePower instead)
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -268,14 +282,18 @@ powerproxy.parabombs:
|
|||||||
CameraActor: camera
|
CameraActor: camera
|
||||||
|
|
||||||
powerproxy.sonarpulse:
|
powerproxy.sonarpulse:
|
||||||
SonarPulsePower:
|
SpawnActorPower:
|
||||||
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
|
||||||
|
Actor: sonar
|
||||||
|
LifeTime: 250
|
||||||
|
DeploySound: sonpulse.aud
|
||||||
|
EffectSequence: moveflsh
|
||||||
|
EffectPalette: moveflash
|
||||||
|
|
||||||
mpspawn:
|
mpspawn:
|
||||||
Immobile:
|
Immobile:
|
||||||
|
|||||||
Reference in New Issue
Block a user