diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj
index a1e1d691a3..b211f9c12c 100644
--- a/OpenRA.Game/OpenRA.Game.csproj
+++ b/OpenRA.Game/OpenRA.Game.csproj
@@ -179,6 +179,7 @@
+
diff --git a/OpenRA.Game/Selection.cs b/OpenRA.Game/Selection.cs
index 38bc05cbd6..2700aee20a 100644
--- a/OpenRA.Game/Selection.cs
+++ b/OpenRA.Game/Selection.cs
@@ -59,8 +59,7 @@ namespace OpenRA
var voicedActor = actors.FirstOrDefault(a => a.Owner == world.LocalPlayer && a.IsInWorld && a.HasTrait());
if (voicedActor != null)
- foreach (var voice in voicedActor.TraitsImplementing())
- voice.PlayVoice(voicedActor, "Select", voicedActor.Owner.Country.Race);
+ voicedActor.PlayVoice("Select");
foreach (var a in newSelection)
foreach (var sel in a.TraitsImplementing())
diff --git a/OpenRA.Game/VoiceExts.cs b/OpenRA.Game/VoiceExts.cs
new file mode 100644
index 0000000000..c63d7a4d69
--- /dev/null
+++ b/OpenRA.Game/VoiceExts.cs
@@ -0,0 +1,75 @@
+#region Copyright & License Information
+/*
+ * Copyright 2007-2015 The OpenRA Developers (see AUTHORS)
+ * This file is part of OpenRA, which is free software. It is made
+ * available to you under the terms of the GNU General Public License
+ * as published by the Free Software Foundation. For more information,
+ * see COPYING.
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using OpenRA.Traits;
+
+namespace OpenRA
+{
+ public static class VoiceExts
+ {
+ public static void PlayVoice(this Actor self, string phrase)
+ {
+ if (phrase == null)
+ return;
+
+ foreach (var voiced in self.TraitsImplementing())
+ {
+ if (string.IsNullOrEmpty(voiced.VoiceSet))
+ return;
+
+ voiced.PlayVoice(self, phrase, self.Owner.Country.Race);
+ }
+ }
+
+ public static void PlayVoiceLocal(this Actor self, string phrase, float volume)
+ {
+ if (phrase == null)
+ return;
+
+ foreach (var voiced in self.TraitsImplementing())
+ {
+ if (string.IsNullOrEmpty(voiced.VoiceSet))
+ return;
+
+ voiced.PlayVoiceLocal(self, phrase, self.Owner.Country.Race, volume);
+ }
+ }
+
+ public static bool HasVoice(this Actor self, string voice)
+ {
+ return self.TraitsImplementing().Any(x => x.HasVoice(self, voice));
+ }
+
+ public static void PlayVoiceForOrders(this World w, Order[] orders)
+ {
+ // Find an actor with a phrase to say
+ foreach (var o in orders)
+ {
+ if (o == null)
+ continue;
+
+ var orderSubject = o.Subject;
+ if (orderSubject.Destroyed)
+ continue;
+
+ foreach (var voice in orderSubject.TraitsImplementing())
+ foreach (var v in orderSubject.TraitsImplementing())
+ {
+ if (voice.PlayVoice(orderSubject, v.VoicePhraseForOrder(orderSubject, o),
+ orderSubject.Owner.Country.Race))
+ return;
+ }
+ }
+ }
+ }
+}
diff --git a/OpenRA.Game/WorldUtils.cs b/OpenRA.Game/WorldUtils.cs
index ae342a3f9c..d3cd04cda8 100644
--- a/OpenRA.Game/WorldUtils.cs
+++ b/OpenRA.Game/WorldUtils.cs
@@ -42,26 +42,6 @@ namespace OpenRA
}
}
- public static void PlayVoiceForOrders(this World w, Order[] orders)
- {
- // Find an actor with a phrase to say
- foreach (var o in orders)
- {
- if (o == null)
- continue;
-
- var orderSubject = o.Subject;
- if (orderSubject.Destroyed)
- continue;
-
- foreach (var voice in orderSubject.TraitsImplementing())
- foreach (var v in orderSubject.TraitsImplementing())
- if (voice.PlayVoice(orderSubject, v.VoicePhraseForOrder(orderSubject, o),
- orderSubject.Owner.Country.Race))
- return;
- }
- }
-
public static void DoTimed(this IEnumerable e, Action a, string text)
{
// Note - manual enumeration here for performance due to high call volume.
diff --git a/OpenRA.Mods.Common/ActorExts.cs b/OpenRA.Mods.Common/ActorExts.cs
index 57f19ca1be..4cbe893c74 100644
--- a/OpenRA.Mods.Common/ActorExts.cs
+++ b/OpenRA.Mods.Common/ActorExts.cs
@@ -80,39 +80,6 @@ namespace OpenRA.Mods.Common
return Target.Invalid;
}
- public static void PlayVoice(this Actor self, Actor actor, string phrase, string variant)
- {
- foreach (var voiced in self.TraitsImplementing())
- {
- if (phrase == null)
- return;
-
- if (string.IsNullOrEmpty(voiced.VoiceSet))
- return;
-
- voiced.PlayVoice(self, phrase, variant);
- }
- }
-
- public static void PlayVoiceLocal(this Actor self, Actor actor, string phrase, string variant, float volume)
- {
- foreach (var voiced in self.TraitsImplementing())
- {
- if (phrase == null)
- return;
-
- if (string.IsNullOrEmpty(voiced.VoiceSet))
- return;
-
- voiced.PlayVoiceLocal(self, phrase, variant, volume);
- }
- }
-
- public static bool HasVoice(this Actor self, string voice)
- {
- return self.TraitsImplementing().Any(x => x.HasVoice(self, voice));
- }
-
public static void NotifyBlocker(this Actor self, IEnumerable blockers)
{
foreach (var blocker in blockers)
diff --git a/OpenRA.Mods.Common/Traits/Sound/AnnounceOnBuild.cs b/OpenRA.Mods.Common/Traits/Sound/AnnounceOnBuild.cs
index e3ceb5fc64..f2b4188cc9 100644
--- a/OpenRA.Mods.Common/Traits/Sound/AnnounceOnBuild.cs
+++ b/OpenRA.Mods.Common/Traits/Sound/AnnounceOnBuild.cs
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
{
public void BuildingComplete(Actor self)
{
- self.PlayVoice(self, "Build", self.Owner.Country.Race);
+ self.PlayVoice("Build");
}
}
}
diff --git a/OpenRA.Mods.Common/Traits/Sound/AnnounceOnKill.cs b/OpenRA.Mods.Common/Traits/Sound/AnnounceOnKill.cs
index 43e1a1e4f7..e5d552d2fc 100644
--- a/OpenRA.Mods.Common/Traits/Sound/AnnounceOnKill.cs
+++ b/OpenRA.Mods.Common/Traits/Sound/AnnounceOnKill.cs
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
if (e.DamageState == DamageState.Dead && damaged != e.Attacker)
{
if (self.World.WorldTick - lastAnnounce > info.Interval * 25)
- self.PlayVoice(self, "Kill", self.Owner.Country.Race);
+ self.PlayVoice("Kill");
lastAnnounce = self.World.WorldTick;
}
diff --git a/OpenRA.Mods.Common/Traits/Sound/DeathSounds.cs b/OpenRA.Mods.Common/Traits/Sound/DeathSounds.cs
index 92b0068a1b..1f590806ed 100644
--- a/OpenRA.Mods.Common/Traits/Sound/DeathSounds.cs
+++ b/OpenRA.Mods.Common/Traits/Sound/DeathSounds.cs
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits
if (info.DeathTypes.Contains(e.Warhead.DeathType) || (!info.DeathTypes.Any() &&
!self.Info.Traits.WithInterface().Any(dsi => dsi.DeathTypes.Contains(e.Warhead.DeathType))))
- self.PlayVoiceLocal(self, info.DeathSound, self.Owner.Country.Race, info.VolumeMultiplier);
+ self.PlayVoiceLocal(info.DeathSound, info.VolumeMultiplier);
}
}
}
\ No newline at end of file