From d643d2ebda5bf4396788695d8fcc0922f6ca5957 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 10 Sep 2017 12:45:49 +0200 Subject: [PATCH] Remove legacy .aud sound defaults from Common traits While C&C-specific sound defaults might be acceptable for C&C-specific traits like MadTank and Chronoshiftable, for common, generic traits like Building they no longer are. --- .../Traits/Buildings/Building.cs | 4 +-- OpenRA.Mods.Common/Traits/EjectOnDeath.cs | 2 +- OpenRA.Mods.Common/Traits/ParaDrop.cs | 2 +- .../Traits/ProductionParadrop.cs | 2 +- .../UtilityCommands/UpgradeRules.cs | 35 +++++++++++++++++++ 5 files changed, 40 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs index c552c9fd3a..37d46bc8c3 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs @@ -55,9 +55,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Clear smudges from underneath the building footprint on transform.")] public readonly bool RemoveSmudgesOnTransform = true; - public readonly string[] BuildSounds = { "placbldg.aud", "build5.aud" }; + public readonly string[] BuildSounds = { }; - public readonly string[] UndeploySounds = { "cashturn.aud" }; + public readonly string[] UndeploySounds = { }; public virtual object Create(ActorInitializer init) { return new Building(init, this); } diff --git a/OpenRA.Mods.Common/Traits/EjectOnDeath.cs b/OpenRA.Mods.Common/Traits/EjectOnDeath.cs index c04def1660..5216de1768 100644 --- a/OpenRA.Mods.Common/Traits/EjectOnDeath.cs +++ b/OpenRA.Mods.Common/Traits/EjectOnDeath.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int SuccessRate = 50; [Desc("Sound to play when ejecting the pilot from the aircraft.")] - public readonly string ChuteSound = "chute1.aud"; + public readonly string ChuteSound = null; [Desc("Can a destroyed aircraft eject its pilot while it has not yet fallen to ground level?")] public readonly bool EjectInAir = false; diff --git a/OpenRA.Mods.Common/Traits/ParaDrop.cs b/OpenRA.Mods.Common/Traits/ParaDrop.cs index 7a43b50979..2d22c56e9d 100644 --- a/OpenRA.Mods.Common/Traits/ParaDrop.cs +++ b/OpenRA.Mods.Common/Traits/ParaDrop.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits public readonly WDist DropRange = WDist.FromCells(4); [Desc("Sound to play when dropping.")] - public readonly string ChuteSound = "chute1.aud"; + public readonly string ChuteSound = null; public object Create(ActorInitializer init) { return new ParaDrop(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/ProductionParadrop.cs b/OpenRA.Mods.Common/Traits/ProductionParadrop.cs index c016098d74..cd3a760858 100644 --- a/OpenRA.Mods.Common/Traits/ProductionParadrop.cs +++ b/OpenRA.Mods.Common/Traits/ProductionParadrop.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits [ActorReference(typeof(AircraftInfo))] public readonly string ActorType = "badr"; [Desc("Sound to play when dropping the unit.")] - public readonly string ChuteSound = "chute1.aud"; + public readonly string ChuteSound = null; [Desc("Notification to play when dropping the unit.")] public readonly string ReadyAudio = null; diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index b86d39291a..12b629b922 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -1674,6 +1674,41 @@ namespace OpenRA.Mods.Common.UtilityCommands } } + if (engineVersion < 20180309) + { + if (node.Key == "ParaDrop") + { + var soundNodePD = node.Value.Nodes.FirstOrDefault(n => n.Key == "ChuteSound"); + if (soundNodePD == null) + node.Value.Nodes.Add(new MiniYamlNode("ChuteSound", "chute1.aud")); + } + + if (depth == 1 && node.Key == "EjectOnDeath") + { + var soundNodeEOD = node.Value.Nodes.FirstOrDefault(n => n.Key == "ChuteSound"); + if (soundNodeEOD == null) + node.Value.Nodes.Add(new MiniYamlNode("ChuteSound", "chute1.aud")); + } + + if (node.Key.StartsWith("ProductionParadrop", StringComparison.Ordinal)) + { + var soundNodePP = node.Value.Nodes.FirstOrDefault(n => n.Key == "ChuteSound"); + if (soundNodePP == null) + node.Value.Nodes.Add(new MiniYamlNode("ChuteSound", "chute1.aud")); + } + + if (node.Key == "Building") + { + var soundNodeB1 = node.Value.Nodes.FirstOrDefault(n => n.Key == "BuildSounds"); + if (soundNodeB1 == null) + node.Value.Nodes.Add(new MiniYamlNode("BuildSounds", "placbldg.aud, build5.aud")); + + var soundNodeB2 = node.Value.Nodes.FirstOrDefault(n => n.Key == "UndeploySounds"); + if (soundNodeB2 == null) + node.Value.Nodes.Add(new MiniYamlNode("UndeploySounds", "cashturn.aud")); + } + } + UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1); }