From 6de12fb0e99b19089ed638ed435641ee03e1440c Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Sat, 2 Jul 2016 15:41:49 +0200 Subject: [PATCH] Add SpeechNotifications for InsufficientPower and Launch on support powers --- .../Traits/SupportPowers/AirstrikePower.cs | 9 +++++---- OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs | 4 ++++ OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs | 2 ++ OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs | 4 ++++ OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs | 2 ++ OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs | 7 +++++-- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs index 212b29263d..6514bd4f45 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs @@ -127,10 +127,11 @@ namespace OpenRA.Mods.Common.Traits self.World.AddFrameEndTask(w => { - var notification = self.Owner.IsAlliedWith(self.World.RenderPlayer) ? Info.LaunchSound : Info.IncomingSound; - Game.Sound.Play(notification); - Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", - Info.IncomingSpeechNotification, self.Owner.Faction.InternalName); + var isAllied = self.Owner.IsAlliedWith(self.World.RenderPlayer); + Game.Sound.Play(isAllied ? Info.LaunchSound : Info.IncomingSound); + + var speech = isAllied ? Info.LaunchSpeechNotification : Info.IncomingSpeechNotification; + Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", speech, self.Owner.Faction.InternalName); Actor distanceTestActor = null; for (var i = -info.SquadSize / 2; i <= info.SquadSize / 2; i++) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs index f2e8691238..acf6296ae5 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs @@ -94,7 +94,11 @@ namespace OpenRA.Mods.Common.Traits base.Activate(self, order, manager); if (self.Owner.IsAlliedWith(self.World.RenderPlayer)) + { Game.Sound.Play(Info.LaunchSound); + Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", + Info.LaunchSpeechNotification, self.Owner.Faction.InternalName); + } else { Game.Sound.Play(Info.IncomingSound); diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index ed583cec29..881df0428a 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -38,7 +38,9 @@ namespace OpenRA.Mods.Common.Traits public readonly string SelectTargetSound = null; public readonly string SelectTargetSpeechNotification = null; public readonly string InsufficientPowerSound = null; + public readonly string InsufficientPowerSpeechNotification = null; public readonly string LaunchSound = null; + public readonly string LaunchSpeechNotification = null; public readonly string IncomingSound = null; public readonly string IncomingSpeechNotification = null; diff --git a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs index ca8b1ff85b..2819ab21f5 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs @@ -114,7 +114,11 @@ namespace OpenRA.Mods.Common.Widgets protected void ClickIcon(SupportPowerIcon clicked) { if (!clicked.Power.Active) + { Game.Sound.PlayToPlayer(spm.Self.Owner, clicked.Power.Info.InsufficientPowerSound); + Game.Sound.PlayNotification(spm.Self.World.Map.Rules, spm.Self.Owner, "Speech", + clicked.Power.Info.InsufficientPowerSpeechNotification, spm.Self.Owner.Faction.InternalName); + } else clicked.Power.Target(); } diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs index a0ea11ec5a..5e1a3792a2 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs @@ -75,6 +75,8 @@ namespace OpenRA.Mods.RA.Traits self.World.AddFrameEndTask(w => { Game.Sound.PlayToPlayer(self.Owner, Info.LaunchSound); + Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", + Info.LaunchSpeechNotification, self.Owner.Faction.InternalName); w.Add(new SatelliteLaunch(self, info)); diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs index b779bb027f..3a4b4981ac 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs @@ -153,8 +153,11 @@ namespace OpenRA.Mods.RA.Traits self.World.AddFrameEndTask(w => { - var notification = self.Owner.IsAlliedWith(self.World.RenderPlayer) ? Info.LaunchSound : Info.IncomingSound; - Game.Sound.Play(notification); + var isAllied = self.Owner.IsAlliedWith(self.World.RenderPlayer); + Game.Sound.Play(isAllied ? Info.LaunchSound : Info.IncomingSound); + + var speech = isAllied ? Info.LaunchSpeechNotification : Info.IncomingSpeechNotification; + Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", speech, self.Owner.Faction.InternalName); Actor distanceTestActor = null;