diff --git a/OpenRA.Game/Selection.cs b/OpenRA.Game/Selection.cs index ac77afc050..66248cb4c5 100644 --- a/OpenRA.Game/Selection.cs +++ b/OpenRA.Game/Selection.cs @@ -42,7 +42,7 @@ namespace OpenRA else actors = (isCombine ? oldSelection.Union(newSelection) : newSelection).ToList(); - var voicedUnit = actors.FirstOrDefault(a => a.Owner == world.LocalPlayer && a.IsInWorld && a.HasVoice()); + var voicedUnit = actors.FirstOrDefault(a => a.Owner == world.LocalPlayer && a.IsInWorld && a.HasVoices()); if (voicedUnit != null) Sound.PlayVoice("Select", voicedUnit, voicedUnit.Owner.Country.Race); diff --git a/OpenRA.Game/WorldUtils.cs b/OpenRA.Game/WorldUtils.cs index 9dcc5e838a..4045c7af59 100755 --- a/OpenRA.Game/WorldUtils.cs +++ b/OpenRA.Game/WorldUtils.cs @@ -151,18 +151,24 @@ namespace OpenRA return new float2(Gauss1D(r, samples), Gauss1D(r, samples)); } - public static bool HasVoice(this Actor a) + public static bool HasVoices(this Actor a) { var selectable = a.Info.Traits.GetOrDefault(); return selectable != null && selectable.Voice != null; } - public static SoundInfo GetVoice(this Actor a) + public static bool HasVoice(this Actor a, string voice) + { + var v = GetVoices(a); + return v != null && v.Voices.ContainsKey(voice); + } + + public static SoundInfo GetVoices(this Actor a) { var selectable = a.Info.Traits.GetOrDefault(); if (selectable == null) return null; var v = selectable.Voice; - return (v == null) ? null : Rules.Voices[v]; + return (v == null) ? null : Rules.Voices[v.ToLowerInvariant()]; } public static void PlayVoiceForOrders(this World w, Order[] orders) diff --git a/OpenRA.Mods.RA/Cargo.cs b/OpenRA.Mods.RA/Cargo.cs index a9add822c1..e202cba0d7 100644 --- a/OpenRA.Mods.RA/Cargo.cs +++ b/OpenRA.Mods.RA/Cargo.cs @@ -118,7 +118,7 @@ namespace OpenRA.Mods.RA public string VoicePhraseForOrder(Actor self, Order order) { if (order.OrderString != "Unload" || IsEmpty(self)) return null; - return "Move"; + return self.HasVoice("Unload") ? "Unload" : "Move"; } public bool HasSpace(int weight) { return totalWeight + weight <= info.MaxWeight; }