diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index 9c7e94472b..14dc5c4d30 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -929,9 +929,12 @@ namespace OpenRa overlayBits.Add(Pair.New(cantBuild.Image, drawPos)); var closureItemName = item.Name; + + var eva = world.LocalPlayer.PlayerActor.Info.Traits.Get(); + AddButton(rect, buildableItems.Contains(item.Name) ? isLmb => HandleBuildPalette(world, closureItemName, isLmb) - : (Action)(_ => Sound.Play("briefing.aud"))); + : (Action)(_ => Sound.Play(eva.TabClick))); if (++x == columns) { x = 0; y++; } } diff --git a/OpenRa.Game/Sound.cs b/OpenRa.Game/Sound.cs index 2da679626e..ac34d12bcc 100644 --- a/OpenRa.Game/Sound.cs +++ b/OpenRa.Game/Sound.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -55,6 +55,9 @@ namespace OpenRa public static void Play(string name) { + if (name == "" || name == null) + return; + var sound = sounds[name]; // todo: positioning soundEngine.Play2D(sound, false); diff --git a/OpenRa.Game/Traits/Activities/UndeployMcv.cs b/OpenRa.Game/Traits/Activities/UndeployMcv.cs index c4eab678cc..4469833428 100644 --- a/OpenRa.Game/Traits/Activities/UndeployMcv.cs +++ b/OpenRa.Game/Traits/Activities/UndeployMcv.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -19,6 +19,7 @@ #endregion using System; +using OpenRa.Traits; namespace OpenRa.Traits.Activities { @@ -46,7 +47,7 @@ namespace OpenRa.Traits.Activities rb.PlayCustomAnimBackwards(self, "make", () => self.World.AddFrameEndTask(w => DoUndeploy(w,self))); - Sound.PlayToPlayer(self.Owner, "cashturn.aud"); + Sound.PlayToPlayer(self.Owner, self.Owner.PlayerActor.Info.Traits.Get().SellSound); started = true; } diff --git a/OpenRa.Game/Traits/Player/PlaceBuilding.cs b/OpenRa.Game/Traits/Player/PlaceBuilding.cs index 3b77f17cd0..31b994e86f 100644 --- a/OpenRa.Game/Traits/Player/PlaceBuilding.cs +++ b/OpenRa.Game/Traits/Player/PlaceBuilding.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -22,7 +22,11 @@ using System.Linq; namespace OpenRa.Traits { - class PlaceBuildingInfo : StatelessTraitInfo { } + class PlaceBuildingInfo : StatelessTraitInfo + { + public readonly string[] BuildSounds = {"placbldg.aud", "build5.aud"}; + public readonly string SellSound = "cashturn.aud"; + } class PlaceBuilding : IResolveOrder { @@ -39,8 +43,10 @@ namespace OpenRa.Traits return; self.World.CreateActor( order.TargetString, order.TargetLocation, order.Player ); - Sound.PlayToPlayer(order.Player, "placbldg.aud"); - Sound.PlayToPlayer(order.Player, "build5.aud"); + var info = self.Info.Traits.Get(); + + foreach (var s in info.BuildSounds) + Sound.PlayToPlayer(order.Player, s); var facts = self.World.Queries.OwnedBy[self.Owner] .WithTrait().Select(x => x.Actor); diff --git a/OpenRa.Game/Traits/Render/RenderBuilding.cs b/OpenRa.Game/Traits/Render/RenderBuilding.cs index cf6adf91ca..5cd543afd2 100644 --- a/OpenRa.Game/Traits/Render/RenderBuilding.cs +++ b/OpenRa.Game/Traits/Render/RenderBuilding.cs @@ -128,7 +128,7 @@ namespace OpenRa.Traits if( !Game.skipMakeAnims && self.Info.Traits.Get().HasMakeAnimation ) anim.PlayBackwardsThen( "make", null ); - Sound.PlayToPlayer(self.Owner, "cashturn.aud"); + Sound.PlayToPlayer(self.Owner, self.Owner.PlayerActor.Info.Traits.Get().SellSound); } public void Sold(Actor self) { DoBib(self, true); } diff --git a/mods/cnc/system.yaml b/mods/cnc/system.yaml index 4126f89b58..a5a3d85160 100644 --- a/mods/cnc/system.yaml +++ b/mods/cnc/system.yaml @@ -14,14 +14,16 @@ Player: UnitReadyAudio: unitredy.aud OnHoldAudio: onhold1.aud CancelledAudio: cancel1.aud -# CashTickUp: clock1.aud -# CashTickDown: clock1.aud + CashTickUp: tone15.aud + CashTickDown: LowPower: lopower1.aud SilosNeeded: silos1.aud UnitLost: unitlost.aud NavalUnitLost: unitlost.aud PrimaryBuildingSelected: pribldg1.aud PlaceBuilding: + BuildSounds: constru2.aud, hvydoor1.aud + SellSound: cashturn.aud SpawnDefaultUnits: World: diff --git a/mods/cnc/vehicles.yaml b/mods/cnc/vehicles.yaml index 20c4267733..0f309385a0 100644 --- a/mods/cnc/vehicles.yaml +++ b/mods/cnc/vehicles.yaml @@ -20,7 +20,7 @@ MCV: TransformsInto: fact Offset:-1,-1 DeployDirections: 96 - TransformSounds: placbldg.aud, build5.aud + TransformSounds: constru2.aud, hvydoor1.aud NoTransformSounds: nodeply1.aud RenderUnit: