diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForCash.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForCash.cs index 0bbd111088..96528d68bb 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForCash.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForCash.cs @@ -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))); diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs index 5a3a38eca8..9ec19a7010 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForExploration.cs @@ -21,6 +21,14 @@ namespace OpenRA.Mods.Cnc.Traits { public readonly BitSet Types = default(BitSet); + [NotificationReference("Speech")] + [Desc("Sound the victim will hear when they get sabotaged.")] + public readonly string InfiltratedNotification = null; + + [NotificationReference("Speech")] + [Desc("Sound the perpetrator will hear after successful infiltration.")] + public readonly string InfiltrationNotification = null; + public object Create(ActorInitializer init) { return new InfiltrateForExploration(init.Self, this); } } @@ -38,6 +46,12 @@ namespace OpenRA.Mods.Cnc.Traits if (!info.Types.Overlaps(types)) return; + 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); + infiltrator.Owner.Shroud.Explore(self.Owner.Shroud); var preventReset = self.Owner.PlayerActor.TraitsImplementing() .Any(p => p.PreventShroudReset(self)); diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForPowerOutage.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForPowerOutage.cs index 985910e7be..827799e500 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForPowerOutage.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForPowerOutage.cs @@ -19,8 +19,17 @@ namespace OpenRA.Mods.Cnc.Traits { public readonly BitSet Types = default(BitSet); + [Desc("Measured in ticks.")] public readonly int Duration = 25 * 20; + [NotificationReference("Speech")] + [Desc("Sound the victim will hear when they get sabotaged.")] + public readonly string InfiltratedNotification = null; + + [NotificationReference("Speech")] + [Desc("Sound the perpetrator will hear after successful infiltration.")] + public readonly string InfiltrationNotification = null; + public object Create(ActorInitializer init) { return new InfiltrateForPowerOutage(init.Self, this); } } @@ -40,6 +49,12 @@ namespace OpenRA.Mods.Cnc.Traits if (!info.Types.Overlaps(types)) return; + 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); + playerPower.TriggerPowerOutage(info.Duration); } diff --git a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPower.cs b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPower.cs index ebe0089d04..8a8f244721 100644 --- a/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPower.cs +++ b/OpenRA.Mods.Cnc/Traits/Infiltration/InfiltrateForSupportPower.cs @@ -23,6 +23,14 @@ namespace OpenRA.Mods.Cnc.Traits public readonly BitSet Types = default(BitSet); + [NotificationReference("Speech")] + [Desc("Sound the victim will hear when technology gets stolen.")] + public readonly string InfiltratedNotification = null; + + [NotificationReference("Speech")] + [Desc("Sound the perpetrator will hear after successful infiltration.")] + public readonly string InfiltrationNotification = null; + public object Create(ActorInitializer init) { return new InfiltrateForSupportPower(this); } } @@ -40,6 +48,12 @@ namespace OpenRA.Mods.Cnc.Traits if (!info.Types.Overlaps(types)) return; + 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); + infiltrator.World.AddFrameEndTask(w => w.CreateActor(info.Proxy, new TypeDictionary { new OwnerInit(infiltrator.Owner) diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameInfiltrationNotifications.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameInfiltrationNotifications.cs new file mode 100644 index 0000000000..b12bc0cb44 --- /dev/null +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20200202/RenameInfiltrationNotifications.cs @@ -0,0 +1,35 @@ +#region Copyright & License Information +/* + * Copyright 2007-2020 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. For more + * information, see COPYING. + */ +#endregion + +using System.Collections.Generic; + +namespace OpenRA.Mods.Common.UpdateRules.Rules +{ + class RenameInfiltrationNotifications : UpdateRule + { + public override string Name { get { return "Renamed InfiltrateForCash Notification to InfiltratedNotification."; } } + public override string Description + { + get + { + return "The InfiltrateForCash Notification has been renamed to be in line with new notification properties added."; + } + } + + public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) + { + foreach (var rp in actorNode.ChildrenMatching("InfiltrateForCash")) + rp.RenameChildrenMatching("Notification", "InfiltratedNotification"); + + yield break; + } + } +} diff --git a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs index 9679aee6b6..8768b95ab7 100644 --- a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs +++ b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs @@ -80,6 +80,7 @@ namespace OpenRA.Mods.Common.UpdateRules // Bleed only changes here new AddPipDecorationTraits(), new ModernizeDecorationTraits(), + new RenameInfiltrationNotifications(), }) }; diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index bbf64849e0..28d3e823a6 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -1221,7 +1221,7 @@ PROC: InfiltrateForCash: Percentage: 50 Types: SpyInfiltrate, ThiefInfiltrate - Notification: CreditsStolen + InfiltratedNotification: CreditsStolen WithBuildingBib: WithIdleOverlay@TOP: RequiresCondition: !build-incomplete @@ -1283,7 +1283,7 @@ SILO: InfiltrateForCash: Percentage: 50 Types: ThiefInfiltrate - Notification: CreditsStolen + InfiltratedNotification: CreditsStolen WithBuildingBib: HasMinibib: true -WithSpriteBody: