Add actual notification support for *CrateAction traits

This commit is contained in:
Mustafa Alperen Seki
2018-10-12 15:50:46 +03:00
committed by Paul Chote
parent f066655bb7
commit 5f17f0b5b0

View File

@@ -29,6 +29,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Audio clip to play when the crate is collected.")]
public readonly string Sound = null;
[Desc("Notification to play when the crate is collected.")]
[NotificationReference("Speech")] public readonly string Notification = null;
[Desc("The earliest time (in ticks) that this crate action can occur on.")]
public readonly int TimeDelay = 0;
@@ -77,6 +80,10 @@ namespace OpenRA.Mods.Common.Traits
{
Game.Sound.PlayToPlayer(SoundType.World, collector.Owner, Info.Sound);
if (!string.IsNullOrEmpty(Info.Notification))
Game.Sound.PlayNotification(self.World.Map.Rules, collector.Owner, "Speech",
Info.Notification, collector.Owner.Faction.InternalName);
if (Info.Effect != null)
collector.World.AddFrameEndTask(w => w.Add(new CrateEffect(collector, Info.Effect, Info.Palette)));
}