Fix multiple notifications in multiplayer bug

This commit is contained in:
penev92
2015-02-22 22:24:00 +02:00
parent 1261fd1b07
commit 58ab28206f
2 changed files with 7 additions and 5 deletions

View File

@@ -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<AnnounceOnSeen> 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)

View File

@@ -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)