Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added helicopter takeoff and landing sound #8784

Merged
merged 2 commits into from Aug 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions OpenRA.Mods.Common/Activities/Air/HeliFly.cs
Expand Up @@ -21,6 +21,7 @@ public class HeliFly : Activity
readonly Target target;
readonly WDist maxRange;
readonly WDist minRange;
bool playedSound;

public HeliFly(Actor self, Target t)
{
Expand Down Expand Up @@ -53,6 +54,12 @@ public override Activity Tick(Actor self)
if (IsCanceled || !target.IsValidFor(self))
return NextActivity;

if (!playedSound && helicopter.Info.TakeoffSound != null && self.IsAtGroundLevel())
{
Sound.Play(helicopter.Info.TakeoffSound);
playedSound = true;
}

if (AdjustAltitude(self, helicopter, helicopter.Info.CruiseAltitude))
return this;

Expand Down
11 changes: 8 additions & 3 deletions OpenRA.Mods.Common/Activities/Air/HeliLand.cs
Expand Up @@ -16,14 +16,13 @@ namespace OpenRA.Mods.Common.Activities
public class HeliLand : Activity
{
readonly Helicopter helicopter;
readonly WDist landAltitude;
bool requireSpace;
bool playedSound;

public HeliLand(Actor self, bool requireSpace)
{
this.requireSpace = requireSpace;
helicopter = self.Trait<Helicopter>();
landAltitude = helicopter.Info.LandAltitude;
}

public override Activity Tick(Actor self)
Expand All @@ -34,7 +33,13 @@ public override Activity Tick(Actor self)
if (requireSpace && !helicopter.CanLand(self.Location))
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 NextActivity;
Expand Down
3 changes: 3 additions & 0 deletions OpenRA.Mods.Common/Traits/Air/Helicopter.cs
Expand Up @@ -30,6 +30,9 @@ public class HelicopterInfo : AircraftInfo, IMoveInfo
[Desc("How fast the helicopter ascends or descends.")]
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); }
}

Expand Down
12 changes: 12 additions & 0 deletions mods/ts/rules/aircraft.yaml
Expand Up @@ -45,6 +45,8 @@ DSHP:
Speed: 168
InitialFacing: 0
LandableTerrainTypes: Clear
TakeoffSound: dropup1.aud
LandingSound: dropdwn1.aud
Health:
HP: 200
Armor:
Expand Down Expand Up @@ -144,12 +146,19 @@ ORCATRAN:
Cost: 1200
Tooltip:
Name: Orca Transport
Buildable:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated to takeoff and landing sounds, so needs to be at least in its own commit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separated.

Queue: Air
BuildPaletteOrder: 10
Prerequisites: ~disabled
RenderSprites:
Helicopter:
LandWhenIdle: yes
ROT: 5
Speed: 84
InitialFacing: 0
LandableTerrainTypes: Clear
TakeoffSound: dropup1.aud
LandingSound: dropdwn1.aud
Health:
HP: 200
Armor:
Expand Down Expand Up @@ -181,6 +190,9 @@ TRNSPORT:
Speed: 149
InitialFacing: 0
LandableTerrainTypes: Clear
TakeoffSound: dropup1.aud
LandingSound: dropdwn1.aud
AltitudeVelocity: 64
Health:
HP: 175
Armor:
Expand Down
5 changes: 4 additions & 1 deletion mods/ts/sequences/aircraft.yaml
Expand Up @@ -16,4 +16,7 @@ apache:
Length: 4
slow-rotor: lrotor
Start: 4
Length: 8
Length: 8

orcatran:
icon: crryicon