Add SuppressNotifications flag for scripted maps.

This commit is contained in:
Paul Chote
2017-01-29 16:51:58 +00:00
parent 7a1d1092bd
commit aa0e65d425
2 changed files with 20 additions and 6 deletions

View File

@@ -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)