From 460d0b84a6e7500cee8ed907bb23767bb8b29fcc Mon Sep 17 00:00:00 2001 From: penev92 Date: Sun, 22 Mar 2015 12:26:34 +0200 Subject: [PATCH] Fix EnemyWatcher's interaction with disguised actors --- OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs | 5 ++--- OpenRA.Mods.Common/Traits/Sound/AnnounceOnSeen.cs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs b/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs index 115bfce887..37f87fc113 100644 --- a/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs +++ b/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs @@ -69,9 +69,8 @@ namespace OpenRA.Mods.Common.Traits foreach (var actor in self.World.ActorsWithTrait()) { - // We don't want notifications for allied actors - if ((actor.Actor.EffectiveOwner != null && self.Owner.Stances[actor.Actor.EffectiveOwner.Owner] == Stance.Ally) - || self.Owner.Stances[actor.Actor.Owner] == Stance.Ally) + // We don't want notifications for allied actors or actors disguised as such + if (actor.Actor.AppearsFriendlyTo(self)) continue; if (actor.Actor.IsDead || !actor.Actor.IsInWorld) diff --git a/OpenRA.Mods.Common/Traits/Sound/AnnounceOnSeen.cs b/OpenRA.Mods.Common/Traits/Sound/AnnounceOnSeen.cs index 09eff580ec..0f7372354d 100644 --- a/OpenRA.Mods.Common/Traits/Sound/AnnounceOnSeen.cs +++ b/OpenRA.Mods.Common/Traits/Sound/AnnounceOnSeen.cs @@ -45,9 +45,8 @@ namespace OpenRA.Mods.Common.Traits return; // Hack to disable notifications for neutral actors so some custom maps don't need fixing - if (!Info.AnnounceNeutrals && - ((self.EffectiveOwner != null && discoverer.Stances[self.EffectiveOwner.Owner] != Stance.Enemy) - || discoverer.Stances[self.Owner] != Stance.Enemy)) + // At this point it's either neutral or an enemy + if (!Info.AnnounceNeutrals && !self.AppearsHostileTo(discoverer.PlayerActor)) return; // Audio notification