Add infiltration sounds support to InfiltrateForSupportPowerReset

This commit is contained in:
abcdefg30
2020-05-04 19:55:14 +02:00
committed by atlimit8
parent 5ec136b57c
commit 265d296db6

View File

@@ -21,6 +21,14 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("The `TargetTypes` from `Targetable` that are allowed to enter.")]
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
[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 InfiltrateForSupportPowerReset(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);
var manager = self.Owner.PlayerActor.Trait<SupportPowerManager>();
var powers = manager.GetPowersForActor(self).Where(sp => !sp.Disabled);
foreach (var power in powers)