Add additional notification support to infiltration.

This commit is contained in:
Matthias Mailänder
2020-03-18 15:59:02 +01:00
committed by atlimit8
parent 2c7a56625c
commit 73a2b59c2c
7 changed files with 91 additions and 5 deletions

View File

@@ -34,7 +34,11 @@ namespace OpenRA.Mods.Cnc.Traits
[NotificationReference("Speech")]
[Desc("Sound the victim will hear when they get robbed.")]
public readonly string Notification = null;
public readonly string InfiltratedNotification = null;
[NotificationReference("Speech")]
[Desc("Sound the perpetrator will hear after successful infiltration.")]
public readonly string InfiltrationNotification = null;
[Desc("Whether to show the cash tick indicators rising from the actor.")]
public readonly bool ShowTicks = true;
@@ -63,8 +67,11 @@ namespace OpenRA.Mods.Cnc.Traits
targetResources.TakeCash(toTake);
spyResources.GiveCash(toGive);
if (info.Notification != null)
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName);
if (info.InfiltratedNotification != null)
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.InfiltratedNotification, self.Owner.Faction.InternalName);
if (info.InfiltrationNotification != null)
Game.Sound.PlayNotification(self.World.Map.Rules, infiltrator.Owner, "Speech", info.InfiltrationNotification, infiltrator.Owner.Faction.InternalName);
if (info.ShowTicks)
self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, infiltrator.Owner.Color, FloatingText.FormatCashTick(toGive), 30)));