diff --git a/OpenRA.Mods.RA/Crates/SupportPowerCrateAction.cs b/OpenRA.Mods.RA/Crates/SupportPowerCrateAction.cs index a3a639f2a9..42b8476aa3 100644 --- a/OpenRA.Mods.RA/Crates/SupportPowerCrateAction.cs +++ b/OpenRA.Mods.RA/Crates/SupportPowerCrateAction.cs @@ -16,6 +16,7 @@ namespace OpenRA.Mods.RA.Crates { class SupportPowerCrateActionInfo : CrateActionInfo { + [ActorReference] public readonly string Proxy = null; public override object Create(ActorInitializer init) { return new SupportPowerCrateAction(init.self, this); } } diff --git a/OpenRA.Mods.RA/InfiltrateForSupportPower.cs b/OpenRA.Mods.RA/InfiltrateForSupportPower.cs index c41048185b..0df30381b0 100644 --- a/OpenRA.Mods.RA/InfiltrateForSupportPower.cs +++ b/OpenRA.Mods.RA/InfiltrateForSupportPower.cs @@ -10,30 +10,31 @@ using System.Linq; using OpenRA.Traits; +using OpenRA.FileFormats; namespace OpenRA.Mods.RA { class InfiltrateForSupportPowerInfo : ITraitInfo { - public readonly string Power = null; + [ActorReference] + public readonly string Proxy = null; public object Create(ActorInitializer init) { return new InfiltrateForSupportPower(this); } } class InfiltrateForSupportPower : IAcceptSpy { - InfiltrateForSupportPowerInfo info; + InfiltrateForSupportPowerInfo Info; public InfiltrateForSupportPower(InfiltrateForSupportPowerInfo info) { - this.info = info; + Info = info; } public void OnInfiltrate(Actor self, Actor spy) { - throw new System.NotImplementedException(); - //var p = spy.Owner.PlayerActor.TraitsImplementing() - // .FirstOrDefault(sp => sp.GetType().Name == info.Power); - // - //if (p != null) p.Give(1); + spy.World.AddFrameEndTask(w => w.CreateActor(Info.Proxy, new TypeDictionary + { + new OwnerInit( spy.Owner ) + })); } } } diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 927804d3a3..09115ca44a 100755 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -65,7 +65,7 @@ GAP: SPEN: InfiltrateForSupportPower: - Power: SonarPulsePower + Proxy: powerproxy.sonarpulse Inherits: ^Building Valued: Cost: 650 @@ -120,7 +120,7 @@ SPEN: SYRD: InfiltrateForSupportPower: - Power: SonarPulsePower + Proxy: powerproxy.sonarpulse Inherits: ^Building Buildable: Queue: Building diff --git a/mods/ra/rules/system.yaml b/mods/ra/rules/system.yaml index f19025be5b..36389f194f 100644 --- a/mods/ra/rules/system.yaml +++ b/mods/ra/rules/system.yaml @@ -25,14 +25,6 @@ Player: BuildSpeed: .4 LowPowerSlowdown: 3 PlaceBuilding: -# SonarPulsePower: -# Image: sonricon -# ChargeTime: 10 -# Description: Sonar Pulse (Single Use) -# LongDesc: Reveals all submarines on the map for a \nshort time. -# OneShot: yes -# EndChargeSound: pulse1.aud -# SelectTargetSound: slcttgt1.aud SupportPowerManager: ConquestVictoryConditions: PowerManager: @@ -225,8 +217,7 @@ CRATE: Effect: reveal-map SupportPowerCrateAction@parabombs: SelectionShares: 50000 - Proxy: crateproxy.parabombs - RequiresRace: no + Proxy: powerproxy.parabombs GiveMcvCrateAction: SelectionShares: 2 NoBaseSelectionShares: 9001 @@ -274,7 +265,7 @@ FLARE: Tooltip: Name: Flare -crateproxy.parabombs: +powerproxy.parabombs: AirstrikePower: Image: pbmbicon Description: Parabombs (Single Use) @@ -283,4 +274,14 @@ crateproxy.parabombs: AllowMultiple: yes UnitType: badr.bomber SelectTargetSound: slcttgt1.aud - FlareType: flare \ No newline at end of file + FlareType: flare + +powerproxy.sonarpulse: + SonarPulsePower: + Image: sonricon + Description: Sonar Pulse (Single Use) + LongDesc: Reveals all submarines on the map for a \nshort time. + AllowMultiple: yes + OneShot: yes + EndChargeSound: pulse1.aud + SelectTargetSound: slcttgt1.aud \ No newline at end of file