Merge pull request #7524 from penev92/bleed_enemySightedNotification1

Fix the EnemyWatcher trait (hotfix)
This commit is contained in:
Oliver Brakmann
2015-03-08 15:44:31 +01:00
2 changed files with 12 additions and 11 deletions

View File

@@ -22,8 +22,8 @@ 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.")]
public readonly int NotificationInterval = 200;
[Desc("Minimal ticks in-between notifications.")]
public readonly int NotificationInterval = 750;
public object Create(ActorInitializer init) { return new EnemyWatcher(init.Self, this); }
}
@@ -75,6 +75,9 @@ namespace OpenRA.Mods.Common.Traits
|| self.Owner.Stances[actor.Actor.Owner] != Stance.Enemy)
continue;
if (actor.Actor.IsDead || !actor.Actor.IsInWorld)
continue;
// The actor is not currently visible
if (!self.Owner.Shroud.IsVisible(actor.Actor))
continue;
@@ -89,7 +92,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 +105,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)
@@ -113,11 +115,7 @@ namespace OpenRA.Mods.D2k.Activities
if (self.World.SharedRandom.Next() % 100 <= sandworm.Info.ChanceToDisappear)
{
self.CancelActivity();
self.World.AddFrameEndTask(w => w.Remove(self));
var wormManager = self.World.WorldActor.TraitOrDefault<WormManager>();
if (wormManager != null)
wormManager.DecreaseWormCount();
self.World.AddFrameEndTask(w => self.Kill(self));
}
else
renderUnit.DefaultAnimation.ReplaceAnim("idle");