Skip to content

Commit

Permalink
Add support for playing a "LoseNotification" to the old owner through…
Browse files Browse the repository at this point in the history
… CaptureNotification
  • Loading branch information
abcdefg30 committed Apr 17, 2016
1 parent a1d39b0 commit 03ac9db
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions OpenRA.Mods.Common/Traits/Sound/CaptureNotification.cs
Expand Up @@ -21,6 +21,12 @@ public class CaptureNotificationInfo : ITraitInfo
[Desc("Specifies if Notification is played with the voice of the new owners faction.")]
public readonly bool NewOwnerVoice = true;

[Desc("The speech notification to play to the old owner.")]
public readonly string LoseNotification = null;

[Desc("Specifies if LooseNotification is played with the voice of the new owners faction.")]
public readonly bool LoseNewOwnerVoice = false;

public object Create(ActorInitializer init) { return new CaptureNotification(this); }
}

Expand All @@ -36,6 +42,9 @@ public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner
{
var faction = info.NewOwnerVoice ? newOwner.Faction.InternalName : oldOwner.Faction.InternalName;
Game.Sound.PlayNotification(self.World.Map.Rules, newOwner, "Speech", info.Notification, faction);

var loseFaction = info.LoseNewOwnerVoice ? newOwner.Faction.InternalName : oldOwner.Faction.InternalName;
Game.Sound.PlayNotification(self.World.Map.Rules, oldOwner, "Speech", info.LoseNotification, loseFaction);
}
}
}

0 comments on commit 03ac9db

Please sign in to comment.