Add SuppressNotifications flag for scripted maps.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user