From af3d8d4860ab89bdaa6aadeed0eeae03d489af0c Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sun, 17 Apr 2016 16:17:32 +0200 Subject: [PATCH] Add support for playing a "LoseNotification" to the old owner through CaptureNotification --- OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs b/OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs index 164b67686ae7..1cc8cc01c9c7 100644 --- a/OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs +++ b/OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs @@ -21,6 +21,12 @@ public class CaptureNotificationInfo : ITraitInfo [Desc("Specifies if Notification is played with the voice of the new owners faction.")] public readonly bool NewOwnerVoice = true; + [Desc("The speech notification to play to the old owner.")] + public readonly string LoseNotification = null; + + [Desc("Specifies if LoseNotification is played with the voice of the new owners faction.")] + public readonly bool LoseNewOwnerVoice = false; + public object Create(ActorInitializer init) { return new CaptureNotification(this); } } @@ -36,6 +42,9 @@ public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner { var faction = info.NewOwnerVoice ? newOwner.Faction.InternalName : oldOwner.Faction.InternalName; Game.Sound.PlayNotification(self.World.Map.Rules, newOwner, "Speech", info.Notification, faction); + + var loseFaction = info.LoseNewOwnerVoice ? newOwner.Faction.InternalName : oldOwner.Faction.InternalName; + Game.Sound.PlayNotification(self.World.Map.Rules, oldOwner, "Speech", info.LoseNotification, loseFaction); } } }