From 7a1d1092bded88da39603c925e0c09621b939841 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 29 Jan 2017 16:43:36 +0000 Subject: [PATCH 1/5] Replace "Debug" prefix with "Battlefield Control" for win/loss messages. --- .../Traits/Player/ConquestVictoryConditions.cs | 5 +++-- .../Traits/Player/StrategicVictoryConditions.cs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs index 1e65a037af..2de37cf32e 100644 --- a/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs @@ -9,6 +9,7 @@ */ #endregion +using System.Drawing; using System.Linq; using OpenRA.Traits; @@ -58,7 +59,7 @@ namespace OpenRA.Mods.Common.Traits public void OnPlayerLost(Player player) { - Game.Debug("{0} is defeated.", player.PlayerName); + 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); @@ -72,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits public void OnPlayerWon(Player player) { - Game.Debug("{0} is victorious.", player.PlayerName); + Game.AddChatLine(Color.White, "Battlefield Control", player.PlayerName + " is victorious."); Game.RunAfterDelay(info.NotificationDelay, () => { diff --git a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs index 0195500607..244eda5be7 100644 --- a/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs +++ b/OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs @@ -10,6 +10,7 @@ #endregion using System.Collections.Generic; +using System.Drawing; using System.Linq; using OpenRA.Traits; @@ -103,7 +104,7 @@ namespace OpenRA.Mods.Common.Traits public void OnPlayerLost(Player player) { - Game.Debug("{0} is defeated.", player.PlayerName); + 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); @@ -117,7 +118,7 @@ namespace OpenRA.Mods.Common.Traits public void OnPlayerWon(Player player) { - Game.Debug("{0} is victorious.", player.PlayerName); + Game.AddChatLine(Color.White, "Battlefield Control", player.PlayerName + " is victorious."); Game.RunAfterDelay(info.NotificationDelay, () => { From aa0e65d425720746e277dcc63d52c26c30800195 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 29 Jan 2017 16:51:58 +0000 Subject: [PATCH 2/5] Add SuppressNotifications flag for scripted maps. --- .../Traits/Player/ConquestVictoryConditions.cs | 13 ++++++++++--- .../Traits/Player/StrategicVictoryConditions.cs | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) 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) From 7f694d27401f9d27a4c10c58c9d41d8f5b8dad40 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 29 Jan 2017 17:01:50 +0000 Subject: [PATCH 3/5] Replace "Debug" prefix with "Battlefield Control" for stance messages. --- OpenRA.Mods.Common/Widgets/UnitCommandWidget.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/UnitCommandWidget.cs b/OpenRA.Mods.Common/Widgets/UnitCommandWidget.cs index a904f31e1c..38103532b2 100644 --- a/OpenRA.Mods.Common/Widgets/UnitCommandWidget.cs +++ b/OpenRA.Mods.Common/Widgets/UnitCommandWidget.cs @@ -158,7 +158,7 @@ namespace OpenRA.Mods.Common.Widgets return new Order("SetUnitStance", a, false) { ExtraData = (uint)nextStance }; }); - Game.Debug("Unit stance set to: {0}".F(nextStance)); + Game.AddChatLine(Color.White, "Battlefield Control", "Unit stance set to: {0}".F(nextStance)); return true; } From f09b41b8b8a6e1bfc47bc4648dd854f68ff780f0 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 29 Jan 2017 17:03:05 +0000 Subject: [PATCH 4/5] Replace "Debug" prefix with "Battlefield Control" for selection messages. --- .../Widgets/WorldInteractionControllerWidget.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs index e82c351a71..c9849d9934 100644 --- a/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs @@ -250,12 +250,12 @@ namespace OpenRA.Mods.Common.Widgets // Check if selecting actors on the screen has selected new units if (ownUnitsOnScreen.Count > World.Selection.Actors.Count()) - Game.Debug("Selected across screen"); + Game.AddChatLine(Color.White, "Battlefield Control", "Selected across screen"); else { // Select actors in the world that have highest selection priority ownUnitsOnScreen = SelectActorsInWorld(World, null, player).SubsetWithHighestSelectionPriority().ToList(); - Game.Debug("Selected across map"); + Game.AddChatLine(Color.White, "Battlefield Control", "Selected across map"); } World.Selection.Combine(World, ownUnitsOnScreen, false, false); @@ -276,12 +276,12 @@ namespace OpenRA.Mods.Common.Widgets // Check if selecting actors on the screen has selected new units if (newSelection.Count > World.Selection.Actors.Count()) - Game.Debug("Selected across screen"); + Game.AddChatLine(Color.White, "Battlefield Control", "Selected across screen"); else { // Select actors in the world that have the same selection class as one of the already selected actors newSelection = SelectActorsInWorld(World, selectedClasses, player).ToList(); - Game.Debug("Selected across map"); + Game.AddChatLine(Color.White, "Battlefield Control", "Selected across map"); } World.Selection.Combine(World, newSelection, true, false); From e1f7e5dac9c9f315aec6b29119d5807bb5233c7e Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 29 Jan 2017 17:02:18 +0000 Subject: [PATCH 5/5] Replace "Debug" prefix with "Battlefield Control" for mute messages. --- .../Widgets/WorldInteractionControllerWidget.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs index c9849d9934..7ded7477b9 100644 --- a/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs @@ -369,12 +369,12 @@ namespace OpenRA.Mods.Common.Widgets if (Game.Settings.Sound.Mute) { Game.Sound.MuteAudio(); - Game.Debug("Audio muted"); + Game.AddChatLine(Color.White, "Battlefield Control", "Audio muted"); } else { Game.Sound.UnmuteAudio(); - Game.Debug("Audio unmuted"); + Game.AddChatLine(Color.White, "Battlefield Control", "Audio unmuted"); } return true;