diff --git a/OpenRA.Mods.Common/Traits/Player/BaseAttackNotifier.cs b/OpenRA.Mods.Common/Traits/Player/BaseAttackNotifier.cs index 307bc296f8..78a2f0072e 100644 --- a/OpenRA.Mods.Common/Traits/Player/BaseAttackNotifier.cs +++ b/OpenRA.Mods.Common/Traits/Player/BaseAttackNotifier.cs @@ -28,6 +28,10 @@ namespace OpenRA.Mods.Common.Traits [Desc("The audio notification type to play.")] public string Notification = "BaseAttack"; + [Desc("The audio notification to play to allies when under attack.", + "Won't play a notification to allies if this is null.")] + public string AllyNotification = null; + public object Create(ActorInitializer init) { return new BaseAttackNotifier(init.Self, this); } } @@ -65,7 +69,13 @@ namespace OpenRA.Mods.Common.Traits if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25) { - Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName); + var rules = self.World.Map.Rules; + Game.Sound.PlayNotification(rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName); + + if (info.AllyNotification != null) + foreach (Player p in self.World.Players) + if (p != self.Owner && p.IsAlliedWith(self.Owner) && p != e.Attacker.Owner) + Game.Sound.PlayNotification(rules, p, "Speech", info.AllyNotification, p.Faction.InternalName); if (radarPings != null) radarPings.Add(() => self.Owner.IsAlliedWith(self.World.RenderPlayer), self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);