Disallow sound/radar notifications for neutral actors via a configurable field on the trait
This commit is contained in:
@@ -22,6 +22,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public readonly string Notification = null;
|
||||
|
||||
public readonly bool AnnounceNeutrals = false;
|
||||
|
||||
public object Create(ActorInitializer init) { return new AnnounceOnSeen(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -42,6 +44,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!playNotification || discoverer != self.World.RenderPlayer)
|
||||
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))
|
||||
return;
|
||||
|
||||
// Audio notification
|
||||
if (discoverer != null && !string.IsNullOrEmpty(Info.Notification))
|
||||
Sound.PlayNotification(self.World.Map.Rules, discoverer, "Speech", Info.Notification, discoverer.Country.Race);
|
||||
|
||||
Reference in New Issue
Block a user