diff --git a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs index 2de37cf32e..ebfd8df8a5 100644 --- a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs @@ -23,6 +23,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Description of the objective.")] [Translate] public readonly string Objective = "Destroy all opposition!"; + [Desc("Disable the win/loss messages and audio notifications?")] + public readonly bool SuppressNotifications = false; + public object Create(ActorInitializer init) { return new ConquestVictoryConditions(init.Self, this); } } @@ -59,11 +62,13 @@ namespace OpenRA.Mods.Common.Traits public void OnPlayerLost(Player player) { - Game.AddChatLine(Color.White, "Battlefield Control", player.PlayerName + " is defeated."); - foreach (var a in player.World.Actors.Where(a => a.Owner == player)) a.Kill(a); + if (info.SuppressNotifications) + return; + + Game.AddChatLine(Color.White, "Battlefield Control", player.PlayerName + " is defeated."); Game.RunAfterDelay(info.NotificationDelay, () => { if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer) @@ -73,8 +78,10 @@ namespace OpenRA.Mods.Common.Traits public void OnPlayerWon(Player player) { - Game.AddChatLine(Color.White, "Battlefield Control", player.PlayerName + " is victorious."); + if (info.SuppressNotifications) + return; + Game.AddChatLine(Color.White, "Battlefield Control", player.PlayerName + " is victorious."); Game.RunAfterDelay(info.NotificationDelay, () => { if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer) diff --git a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs index 244eda5be7..c3307df028 100644 --- a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs @@ -38,6 +38,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Description of the objective")] [Translate] public readonly string Objective = "Hold all the strategic positions!"; + [Desc("Disable the win/loss messages and audio notifications?")] + public readonly bool SuppressNotifications = false; + public object Create(ActorInitializer init) { return new StrategicVictoryConditions(init.Self, this); } } @@ -104,11 +107,13 @@ namespace OpenRA.Mods.Common.Traits public void OnPlayerLost(Player player) { - Game.AddChatLine(Color.White, "Battlefield Control", player.PlayerName + " is defeated."); - foreach (var a in player.World.Actors.Where(a => a.Owner == player)) a.Kill(a); + if (info.SuppressNotifications) + return; + + Game.AddChatLine(Color.White, "Battlefield Control", player.PlayerName + " is defeated."); Game.RunAfterDelay(info.NotificationDelay, () => { if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer) @@ -118,8 +123,10 @@ namespace OpenRA.Mods.Common.Traits public void OnPlayerWon(Player player) { - Game.AddChatLine(Color.White, "Battlefield Control", player.PlayerName + " is victorious."); + if (info.SuppressNotifications) + return; + Game.AddChatLine(Color.White, "Battlefield Control", player.PlayerName + " is victorious."); Game.RunAfterDelay(info.NotificationDelay, () => { if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)