Add support for playing a "LoseNotification" to the old owner through CaptureNotification

This commit is contained in:
abcdefg30
2016-04-17 16:17:32 +02:00
parent a1d39b0a42
commit af3d8d4860

View File

@@ -21,6 +21,12 @@ namespace OpenRA.Mods.Common.Traits.Sound
[Desc("Specifies if Notification is played with the voice of the new owners faction.")] [Desc("Specifies if Notification is played with the voice of the new owners faction.")]
public readonly bool NewOwnerVoice = true; 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); } public object Create(ActorInitializer init) { return new CaptureNotification(this); }
} }
@@ -36,6 +42,9 @@ namespace OpenRA.Mods.Common.Traits.Sound
{ {
var faction = info.NewOwnerVoice ? newOwner.Faction.InternalName : oldOwner.Faction.InternalName; var faction = info.NewOwnerVoice ? newOwner.Faction.InternalName : oldOwner.Faction.InternalName;
Game.Sound.PlayNotification(self.World.Map.Rules, newOwner, "Speech", info.Notification, faction); 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);
} }
} }
} }