Merge pull request #8784 from Mailaender/heli-drop-sounds

Added helicopter takeoff and landing sound
This commit is contained in:
abcdefg30
2015-08-04 14:53:00 +02:00
5 changed files with 34 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ namespace OpenRA.Mods.Common.Activities
readonly Target target; readonly Target target;
readonly WDist maxRange; readonly WDist maxRange;
readonly WDist minRange; readonly WDist minRange;
bool playedSound;
public HeliFly(Actor self, Target t) public HeliFly(Actor self, Target t)
{ {
@@ -53,6 +54,12 @@ namespace OpenRA.Mods.Common.Activities
if (IsCanceled || !target.IsValidFor(self)) if (IsCanceled || !target.IsValidFor(self))
return NextActivity; return NextActivity;
if (!playedSound && helicopter.Info.TakeoffSound != null && self.IsAtGroundLevel())
{
Sound.Play(helicopter.Info.TakeoffSound);
playedSound = true;
}
if (AdjustAltitude(self, helicopter, helicopter.Info.CruiseAltitude)) if (AdjustAltitude(self, helicopter, helicopter.Info.CruiseAltitude))
return this; return this;

View File

@@ -16,14 +16,13 @@ namespace OpenRA.Mods.Common.Activities
public class HeliLand : Activity public class HeliLand : Activity
{ {
readonly Helicopter helicopter; readonly Helicopter helicopter;
readonly WDist landAltitude;
bool requireSpace; bool requireSpace;
bool playedSound;
public HeliLand(Actor self, bool requireSpace) public HeliLand(Actor self, bool requireSpace)
{ {
this.requireSpace = requireSpace; this.requireSpace = requireSpace;
helicopter = self.Trait<Helicopter>(); helicopter = self.Trait<Helicopter>();
landAltitude = helicopter.Info.LandAltitude;
} }
public override Activity Tick(Actor self) public override Activity Tick(Actor self)
@@ -34,7 +33,13 @@ namespace OpenRA.Mods.Common.Activities
if (requireSpace && !helicopter.CanLand(self.Location)) if (requireSpace && !helicopter.CanLand(self.Location))
return this; return this;
if (HeliFly.AdjustAltitude(self, helicopter, landAltitude)) if (!playedSound && helicopter.Info.LandingSound != null && !self.IsAtGroundLevel())
{
Sound.Play(helicopter.Info.LandingSound);
playedSound = true;
}
if (HeliFly.AdjustAltitude(self, helicopter, helicopter.Info.LandAltitude))
return this; return this;
return NextActivity; return NextActivity;

View File

@@ -30,6 +30,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("How fast the helicopter ascends or descends.")] [Desc("How fast the helicopter ascends or descends.")]
public readonly WDist AltitudeVelocity = new WDist(43); public readonly WDist AltitudeVelocity = new WDist(43);
public readonly string TakeoffSound = null;
public readonly string LandingSound = null;
public override object Create(ActorInitializer init) { return new Helicopter(init, this); } public override object Create(ActorInitializer init) { return new Helicopter(init, this); }
} }

View File

@@ -45,6 +45,8 @@ DSHP:
Speed: 168 Speed: 168
InitialFacing: 0 InitialFacing: 0
LandableTerrainTypes: Clear LandableTerrainTypes: Clear
TakeoffSound: dropup1.aud
LandingSound: dropdwn1.aud
Health: Health:
HP: 200 HP: 200
Armor: Armor:
@@ -144,12 +146,19 @@ ORCATRAN:
Cost: 1200 Cost: 1200
Tooltip: Tooltip:
Name: Orca Transport Name: Orca Transport
Buildable:
Queue: Air
BuildPaletteOrder: 10
Prerequisites: ~disabled
RenderSprites:
Helicopter: Helicopter:
LandWhenIdle: yes LandWhenIdle: yes
ROT: 5 ROT: 5
Speed: 84 Speed: 84
InitialFacing: 0 InitialFacing: 0
LandableTerrainTypes: Clear LandableTerrainTypes: Clear
TakeoffSound: dropup1.aud
LandingSound: dropdwn1.aud
Health: Health:
HP: 200 HP: 200
Armor: Armor:
@@ -181,6 +190,9 @@ TRNSPORT:
Speed: 149 Speed: 149
InitialFacing: 0 InitialFacing: 0
LandableTerrainTypes: Clear LandableTerrainTypes: Clear
TakeoffSound: dropup1.aud
LandingSound: dropdwn1.aud
AltitudeVelocity: 64
Health: Health:
HP: 175 HP: 175
Armor: Armor:

View File

@@ -16,4 +16,7 @@ apache:
Length: 4 Length: 4
slow-rotor: lrotor slow-rotor: lrotor
Start: 4 Start: 4
Length: 8 Length: 8
orcatran:
icon: crryicon