diff --git a/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs b/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs index 37f87fc113..3d7247bb03 100644 --- a/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs +++ b/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs @@ -43,8 +43,8 @@ namespace OpenRA.Mods.Common.Traits lastKnownActorIds = new HashSet(); discoveredPlayers = new HashSet(); this.info = info; - rescanInterval = info.ScanInterval; - ticksBeforeNextNotification = info.NotificationInterval; + rescanInterval = 0; + ticksBeforeNextNotification = 0; } // Here self is the player actor @@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits rescanInterval--; ticksBeforeNextNotification--; - if (rescanInterval > 0 || ticksBeforeNextNotification > 0) + if (rescanInterval > 0) return; rescanInterval = info.ScanInterval; @@ -86,11 +86,12 @@ namespace OpenRA.Mods.Common.Traits if (lastKnownActorIds.Contains(actor.Actor.ActorID)) continue; - var notificationPlayed = playedNotifications.Contains(actor.Trait.Info.Notification); + // Should we play a sound notification? + var playNotification = !playedNotifications.Contains(actor.Trait.Info.Notification) && ticksBeforeNextNotification <= 0; // Notify the actor that he has been discovered foreach (var trait in actor.Actor.TraitsImplementing()) - trait.OnDiscovered(actor.Actor, self.Owner, !notificationPlayed); + trait.OnDiscovered(actor.Actor, self.Owner, playNotification); var discoveredPlayer = actor.Actor.Owner; if (!discoveredPlayers.Contains(discoveredPlayer)) @@ -102,8 +103,7 @@ namespace OpenRA.Mods.Common.Traits discoveredPlayers.Add(discoveredPlayer); } - // We have already played this type of notification - if (notificationPlayed) + if (!playNotification) continue; playedNotifications.Add(actor.Trait.Info.Notification); diff --git a/mods/cnc/maps/gdi05a/map.yaml b/mods/cnc/maps/gdi05a/map.yaml index e70ac358a6..7018feb295 100644 --- a/mods/cnc/maps/gdi05a/map.yaml +++ b/mods/cnc/maps/gdi05a/map.yaml @@ -802,7 +802,6 @@ Rules: MissionObjectives: EarlyGameOver: true EnemyWatcher: - NotificationInterval: 25 ^Vehicle: Tooltip: GenericVisibility: Enemy