Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace "Debug" prefix with "Battlefield Control" for gameplay notifications. #12643

Merged
merged 5 commits into from Feb 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions OpenRA.Mods.Common/Traits/Player/ConquestVictoryConditions.cs
Expand Up @@ -9,6 +9,7 @@
*/
#endregion

using System.Drawing;
using System.Linq;
using OpenRA.Traits;

Expand All @@ -22,6 +23,9 @@ public class ConquestVictoryConditionsInfo : ITraitInfo, Requires<MissionObjecti
[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); }
}

Expand Down Expand Up @@ -58,11 +62,13 @@ public void Tick(Actor self)

public void OnPlayerLost(Player player)
{
Game.Debug("{0} is defeated.", player.PlayerName);

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)
Expand All @@ -72,8 +78,10 @@ public void OnPlayerLost(Player player)

public void OnPlayerWon(Player player)
{
Game.Debug("{0} is victorious.", player.PlayerName);
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)
Expand Down
14 changes: 11 additions & 3 deletions OpenRA.Mods.Common/Traits/Player/StrategicVictoryConditions.cs
Expand Up @@ -10,6 +10,7 @@
#endregion

using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Traits;

Expand Down Expand Up @@ -37,6 +38,9 @@ public class StrategicVictoryConditionsInfo : ITraitInfo, Requires<MissionObject
[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); }
}

Expand Down Expand Up @@ -103,11 +107,13 @@ public void Tick(Actor self)

public void OnPlayerLost(Player player)
{
Game.Debug("{0} is defeated.", player.PlayerName);

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)
Expand All @@ -117,8 +123,10 @@ public void OnPlayerLost(Player player)

public void OnPlayerWon(Player player)
{
Game.Debug("{0} is victorious.", player.PlayerName);
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)
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Widgets/UnitCommandWidget.cs
Expand Up @@ -158,7 +158,7 @@ bool PerformStanceCycle()
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;
}
Expand Down
12 changes: 6 additions & 6 deletions OpenRA.Mods.Common/Widgets/WorldInteractionControllerWidget.cs
Expand Up @@ -250,12 +250,12 @@ public override bool HandleKeyPress(KeyInput e)

// 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);
Expand All @@ -276,12 +276,12 @@ public override bool HandleKeyPress(KeyInput e)

// 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);
Expand Down Expand Up @@ -369,12 +369,12 @@ bool ToggleMute()
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;
Expand Down