From 58ab28206fb86509cf96d23a39ff8f8683ef218c Mon Sep 17 00:00:00 2001 From: penev92 Date: Sun, 22 Feb 2015 22:24:00 +0200 Subject: [PATCH] Fix multiple notifications in multiplayer bug --- OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs | 8 ++++---- OpenRA.Mods.D2k/Activities/SwallowActor.cs | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs b/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs index 1488237786..2469ac9479 100644 --- a/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs +++ b/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs @@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Traits [Desc("Interval in ticks between scanning for enemies.")] public readonly int ScanInterval = 25; - [Desc("Minimal interval in ticks between notifications.")] + [Desc("Minimal ticks in-between notifications.")] public readonly int NotificationInterval = 750; public object Create(ActorInitializer init) { return new EnemyWatcher(init.Self, this); } @@ -89,7 +89,8 @@ namespace OpenRA.Mods.Common.Traits if (playedNotifications.Contains(actor.Trait.Info.Notification)) continue; - Announce(self, actor); + if (self.Owner == self.World.RenderPlayer) + Announce(self, actor); } if (announcedAny) @@ -101,8 +102,7 @@ namespace OpenRA.Mods.Common.Traits void Announce(Actor self, TraitPair announce) { // Audio notification - if (self.World.LocalPlayer != null) - Sound.PlayNotification(self.World.Map.Rules, self.World.LocalPlayer, "Speech", announce.Trait.Info.Notification, self.Owner.Country.Race); + Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", announce.Trait.Info.Notification, self.Owner.Country.Race); // Radar notificaion if (announce.Trait.Info.PingRadar && radarPings.Value != null) diff --git a/OpenRA.Mods.D2k/Activities/SwallowActor.cs b/OpenRA.Mods.D2k/Activities/SwallowActor.cs index 1a123dcd98..b38e7ccb43 100644 --- a/OpenRA.Mods.D2k/Activities/SwallowActor.cs +++ b/OpenRA.Mods.D2k/Activities/SwallowActor.cs @@ -93,7 +93,9 @@ namespace OpenRA.Mods.D2k.Activities void NotifyPlayer(Player player, WPos location) { Sound.PlayNotification(player.World.Map.Rules, player, "Speech", swallow.Info.WormAttackNotification, player.Country.Race); - radarPings.Add(() => true, location, Color.Red, 50); + + if (player == player.World.RenderPlayer) + radarPings.Add(() => true, location, Color.Red, 50); } public override Activity Tick(Actor self)