From 1261fd1b076fa83ed05debf10abbc463e0b86bbf Mon Sep 17 00:00:00 2001 From: penev92 Date: Sun, 22 Feb 2015 22:17:24 +0200 Subject: [PATCH 1/3] Increase NotificationInterval to 30 seconds --- OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs b/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs index e703837a9e..1488237786 100644 --- a/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs +++ b/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs @@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits public readonly int ScanInterval = 25; [Desc("Minimal interval in ticks between notifications.")] - public readonly int NotificationInterval = 200; + public readonly int NotificationInterval = 750; public object Create(ActorInitializer init) { return new EnemyWatcher(init.Self, this); } } From 58ab28206fb86509cf96d23a39ff8f8683ef218c Mon Sep 17 00:00:00 2001 From: penev92 Date: Sun, 22 Feb 2015 22:24:00 +0200 Subject: [PATCH 2/3] Fix multiple notifications in multiplayer bug --- OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs | 8 ++++---- OpenRA.Mods.D2k/Activities/SwallowActor.cs | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs b/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs index 1488237786..2469ac9479 100644 --- a/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs +++ b/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs @@ -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 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) diff --git a/OpenRA.Mods.D2k/Activities/SwallowActor.cs b/OpenRA.Mods.D2k/Activities/SwallowActor.cs index 1a123dcd98..b38e7ccb43 100644 --- a/OpenRA.Mods.D2k/Activities/SwallowActor.cs +++ b/OpenRA.Mods.D2k/Activities/SwallowActor.cs @@ -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) From 4a5b3b59ed8f0e60a842e84619e2da90ffe71d1c Mon Sep 17 00:00:00 2001 From: penev92 Date: Thu, 5 Mar 2015 22:22:08 +0200 Subject: [PATCH 3/3] Properly remove worms from the world --- OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs | 3 +++ OpenRA.Mods.D2k/Activities/SwallowActor.cs | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs b/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs index 2469ac9479..257995df43 100644 --- a/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs +++ b/OpenRA.Mods.Common/Traits/Player/EnemyWatcher.cs @@ -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; diff --git a/OpenRA.Mods.D2k/Activities/SwallowActor.cs b/OpenRA.Mods.D2k/Activities/SwallowActor.cs index b38e7ccb43..b9ee1a0a32 100644 --- a/OpenRA.Mods.D2k/Activities/SwallowActor.cs +++ b/OpenRA.Mods.D2k/Activities/SwallowActor.cs @@ -115,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(); - if (wormManager != null) - wormManager.DecreaseWormCount(); + self.World.AddFrameEndTask(w => self.Kill(self)); } else renderUnit.DefaultAnimation.ReplaceAnim("idle");