Add additional notification support to infiltration.
This commit is contained in:
committed by
atlimit8
parent
2c7a56625c
commit
73a2b59c2c
@@ -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)));
|
||||
|
||||
@@ -21,6 +21,14 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
{
|
||||
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
|
||||
|
||||
[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<IPreventsShroudReset>()
|
||||
.Any(p => p.PreventShroudReset(self));
|
||||
|
||||
@@ -19,8 +19,17 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
{
|
||||
public readonly BitSet<TargetableType> Types = default(BitSet<TargetableType>);
|
||||
|
||||
[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);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,14 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
|
||||
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 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)
|
||||
|
||||
@@ -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<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||
{
|
||||
foreach (var rp in actorNode.ChildrenMatching("InfiltrateForCash"))
|
||||
rp.RenameChildrenMatching("Notification", "InfiltratedNotification");
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,7 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
// Bleed only changes here
|
||||
new AddPipDecorationTraits(),
|
||||
new ModernizeDecorationTraits(),
|
||||
new RenameInfiltrationNotifications(),
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user