Merge pull request #5854 from pchote/ra-poster
Add beacons to the RA spy plane and parabombs
This commit is contained in:
@@ -31,6 +31,7 @@ namespace OpenRA.Mods.RA
|
|||||||
AttackBomberInfo info;
|
AttackBomberInfo info;
|
||||||
[Sync] Target target;
|
[Sync] Target target;
|
||||||
[Sync] bool inAttackRange;
|
[Sync] bool inAttackRange;
|
||||||
|
[Sync] bool facingTarget = true;
|
||||||
|
|
||||||
public event Action<Actor> OnRemovedFromWorld = self => { };
|
public event Action<Actor> OnRemovedFromWorld = self => { };
|
||||||
public event Action<Actor> OnEnteredAttackRange = self => { };
|
public event Action<Actor> OnEnteredAttackRange = self => { };
|
||||||
@@ -47,8 +48,14 @@ namespace OpenRA.Mods.RA
|
|||||||
var cp = self.CenterPosition;
|
var cp = self.CenterPosition;
|
||||||
var bombTarget = Target.FromPos(cp - new WVec(0, 0, cp.Z));
|
var bombTarget = Target.FromPos(cp - new WVec(0, 0, cp.Z));
|
||||||
var wasInAttackRange = inAttackRange;
|
var wasInAttackRange = inAttackRange;
|
||||||
|
var wasFacingTarget = facingTarget;
|
||||||
|
|
||||||
inAttackRange = false;
|
inAttackRange = false;
|
||||||
|
|
||||||
|
var f = facing.Value.Facing;
|
||||||
|
var facingToTarget = Util.GetFacing(target.CenterPosition - self.CenterPosition, f);
|
||||||
|
facingTarget = Math.Abs(facingToTarget - f) % 256 <= info.FacingTolerance;
|
||||||
|
|
||||||
// Bombs drop anywhere in range
|
// Bombs drop anywhere in range
|
||||||
foreach (var a in Armaments.Where(a => a.Info.Name == info.Bombs))
|
foreach (var a in Armaments.Where(a => a.Info.Name == info.Bombs))
|
||||||
{
|
{
|
||||||
@@ -60,9 +67,7 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Guns only fire when approaching the target
|
// Guns only fire when approaching the target
|
||||||
var f = facing.Value.Facing;
|
if (facingTarget)
|
||||||
var facingToTarget = Util.GetFacing(target.CenterPosition - self.CenterPosition, f);
|
|
||||||
if (Math.Abs(facingToTarget - f) % 256 <= info.FacingTolerance)
|
|
||||||
{
|
{
|
||||||
foreach (var a in Armaments.Where(a => a.Info.Name == info.Guns))
|
foreach (var a in Armaments.Where(a => a.Info.Name == info.Guns))
|
||||||
{
|
{
|
||||||
@@ -75,6 +80,10 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Actors without armaments may want to trigger an action when it passes the target
|
||||||
|
if (!Armaments.Any())
|
||||||
|
inAttackRange = !wasInAttackRange && !facingTarget && wasFacingTarget;
|
||||||
|
|
||||||
if (inAttackRange && !wasInAttackRange)
|
if (inAttackRange && !wasInAttackRange)
|
||||||
OnEnteredAttackRange(self);
|
OnEnteredAttackRange(self);
|
||||||
|
|
||||||
|
|||||||
@@ -352,7 +352,6 @@
|
|||||||
<Compile Include="SupportPowers\NukePower.cs" />
|
<Compile Include="SupportPowers\NukePower.cs" />
|
||||||
<Compile Include="SupportPowers\ParatroopersPower.cs" />
|
<Compile Include="SupportPowers\ParatroopersPower.cs" />
|
||||||
<Compile Include="SupportPowers\SonarPulsePower.cs" />
|
<Compile Include="SupportPowers\SonarPulsePower.cs" />
|
||||||
<Compile Include="SupportPowers\SpyPlanePower.cs" />
|
|
||||||
<Compile Include="SupportPowers\SupportPower.cs" />
|
<Compile Include="SupportPowers\SupportPower.cs" />
|
||||||
<Compile Include="SupportPowers\SupportPowerChargeBar.cs" />
|
<Compile Include="SupportPowers\SupportPowerChargeBar.cs" />
|
||||||
<Compile Include="SupportPowers\SupportPowerManager.cs" />
|
<Compile Include="SupportPowers\SupportPowerManager.cs" />
|
||||||
|
|||||||
@@ -29,13 +29,6 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int QuantizedFacings = 32;
|
public readonly int QuantizedFacings = 32;
|
||||||
public readonly WRange Cordon = new WRange(5120);
|
public readonly WRange Cordon = new WRange(5120);
|
||||||
|
|
||||||
[ActorReference]
|
|
||||||
[Desc("Actor to spawn when the aircraft first enter the map")]
|
|
||||||
public readonly string FlareActor = null;
|
|
||||||
|
|
||||||
[Desc("Amount of time to keep the flare alive after the aircraft have finished attacking")]
|
|
||||||
public readonly int FlareRemoveDelay = 25;
|
|
||||||
|
|
||||||
[ActorReference]
|
[ActorReference]
|
||||||
[Desc("Actor to spawn when the aircraft start attacking")]
|
[Desc("Actor to spawn when the aircraft start attacking")]
|
||||||
public readonly string CameraActor = null;
|
public readonly string CameraActor = null;
|
||||||
@@ -68,7 +61,6 @@ namespace OpenRA.Mods.RA
|
|||||||
var startEdge = target - (self.World.Map.DistanceToEdge(target, -delta) + info.Cordon).Range * delta / 1024;
|
var startEdge = target - (self.World.Map.DistanceToEdge(target, -delta) + info.Cordon).Range * delta / 1024;
|
||||||
var finishEdge = target + (self.World.Map.DistanceToEdge(target, delta) + info.Cordon).Range * delta / 1024;
|
var finishEdge = target + (self.World.Map.DistanceToEdge(target, delta) + info.Cordon).Range * delta / 1024;
|
||||||
|
|
||||||
Actor flare = null;
|
|
||||||
Actor camera = null;
|
Actor camera = null;
|
||||||
Beacon beacon = null;
|
Beacon beacon = null;
|
||||||
var aircraftInRange = new Dictionary<Actor, bool>();
|
var aircraftInRange = new Dictionary<Actor, bool>();
|
||||||
@@ -104,7 +96,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
aircraftInRange[a] = false;
|
aircraftInRange[a] = false;
|
||||||
|
|
||||||
// Remove the camera and flare when the final plane leaves the target area
|
// Remove the camera when the final plane leaves the target area
|
||||||
if (!aircraftInRange.Any(kv => kv.Value))
|
if (!aircraftInRange.Any(kv => kv.Value))
|
||||||
{
|
{
|
||||||
if (camera != null)
|
if (camera != null)
|
||||||
@@ -113,27 +105,12 @@ namespace OpenRA.Mods.RA
|
|||||||
camera.QueueActivity(new RemoveSelf());
|
camera.QueueActivity(new RemoveSelf());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flare != null)
|
camera = null;
|
||||||
{
|
|
||||||
flare.QueueActivity(new Wait(info.FlareRemoveDelay));
|
|
||||||
flare.QueueActivity(new RemoveSelf());
|
|
||||||
}
|
|
||||||
|
|
||||||
camera = flare = null;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
if (info.FlareActor != null)
|
|
||||||
{
|
|
||||||
flare = w.CreateActor(info.FlareActor, new TypeDictionary
|
|
||||||
{
|
|
||||||
new LocationInit(order.TargetLocation),
|
|
||||||
new OwnerInit(self.Owner),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var notification = self.Owner.IsAlliedWith(self.World.RenderPlayer) ? Info.LaunchSound : Info.IncomingSound;
|
var notification = self.Owner.IsAlliedWith(self.World.RenderPlayer) ? Info.LaunchSound : Info.IncomingSound;
|
||||||
Sound.Play(notification);
|
Sound.Play(notification);
|
||||||
|
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2014 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. For more information,
|
|
||||||
* see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using OpenRA.Mods.RA.Activities;
|
|
||||||
using OpenRA.Mods.RA.Air;
|
|
||||||
using OpenRA.Primitives;
|
|
||||||
using OpenRA.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
|
||||||
{
|
|
||||||
class SpyPlanePowerInfo : SupportPowerInfo
|
|
||||||
{
|
|
||||||
public readonly int RevealTime = 6; // seconds
|
|
||||||
public override object Create(ActorInitializer init) { return new SpyPlanePower(init.self,this); }
|
|
||||||
}
|
|
||||||
|
|
||||||
class SpyPlanePower : SupportPower
|
|
||||||
{
|
|
||||||
public SpyPlanePower(Actor self, SpyPlanePowerInfo info) : base(self, info) { }
|
|
||||||
|
|
||||||
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
|
||||||
{
|
|
||||||
base.Activate(self, order, manager);
|
|
||||||
|
|
||||||
var enterCell = self.World.Map.ChooseRandomEdgeCell(self.World.SharedRandom);
|
|
||||||
var altitude = self.World.Map.Rules.Actors["u2"].Traits.Get<PlaneInfo>().CruiseAltitude;
|
|
||||||
|
|
||||||
var plane = self.World.CreateActor("u2", new TypeDictionary
|
|
||||||
{
|
|
||||||
new CenterPositionInit(self.World.Map.CenterOfCell(enterCell) + new WVec(WRange.Zero, WRange.Zero, altitude)),
|
|
||||||
new OwnerInit(self.Owner),
|
|
||||||
new FacingInit(self.World.Map.FacingBetween(enterCell, order.TargetLocation, 0))
|
|
||||||
});
|
|
||||||
|
|
||||||
plane.CancelActivity();
|
|
||||||
plane.QueueActivity(new Fly(plane, Target.FromCell(self.World, order.TargetLocation)));
|
|
||||||
plane.QueueActivity(new CallFunc(() => plane.World.AddFrameEndTask( w =>
|
|
||||||
{
|
|
||||||
var camera = w.CreateActor("camera", new TypeDictionary
|
|
||||||
{
|
|
||||||
new LocationInit( order.TargetLocation ),
|
|
||||||
new OwnerInit( self.Owner ),
|
|
||||||
});
|
|
||||||
|
|
||||||
camera.QueueActivity(new Wait(25 * ((SpyPlanePowerInfo)Info).RevealTime));
|
|
||||||
camera.QueueActivity(new RemoveSelf());
|
|
||||||
})));
|
|
||||||
plane.QueueActivity(new FlyOffMap());
|
|
||||||
plane.QueueActivity(new RemoveSelf());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -282,6 +282,27 @@ namespace OpenRA.Utility
|
|||||||
node.Key = "ParachuteSequence";
|
node.Key = "ParachuteSequence";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SpyPlanePower was removed (use AirstrikePower instead)
|
||||||
|
if (engineVersion < 20140707)
|
||||||
|
{
|
||||||
|
if (depth == 1 && node.Key == "SpyPlanePower")
|
||||||
|
{
|
||||||
|
node.Key = "AirstrikePower";
|
||||||
|
|
||||||
|
var revealTime = 6 * 25;
|
||||||
|
var revealNode = node.Value.Nodes.FirstOrDefault(n => n.Key == "RevealTime");
|
||||||
|
if (revealNode != null)
|
||||||
|
{
|
||||||
|
revealTime = int.Parse(revealNode.Value.Value) * 25;
|
||||||
|
node.Value.Nodes.Remove(revealNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
node.Value.Nodes.Add(new MiniYamlNode("CameraActor", new MiniYaml("camera")));
|
||||||
|
node.Value.Nodes.Add(new MiniYamlNode("CameraRemoveDelay", new MiniYaml(revealTime.ToString())));
|
||||||
|
node.Value.Nodes.Add(new MiniYamlNode("UnitType", new MiniYaml("u2")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -991,7 +991,6 @@ Rules:
|
|||||||
IncomingSound: enemya.aud
|
IncomingSound: enemya.aud
|
||||||
UnitType: a10
|
UnitType: a10
|
||||||
DisplayBeacon: True
|
DisplayBeacon: True
|
||||||
BeaconDuration: -1
|
|
||||||
BeaconPoster: airstrike
|
BeaconPoster: airstrike
|
||||||
DisplayRadarPing: True
|
DisplayRadarPing: True
|
||||||
CameraActor: camera
|
CameraActor: camera
|
||||||
|
|||||||
@@ -435,7 +435,6 @@ HQ:
|
|||||||
IncomingSound: enemya.aud
|
IncomingSound: enemya.aud
|
||||||
UnitType: a10
|
UnitType: a10
|
||||||
DisplayBeacon: True
|
DisplayBeacon: True
|
||||||
BeaconDuration: -1
|
|
||||||
BeaconPoster: airstrike
|
BeaconPoster: airstrike
|
||||||
DisplayRadarPing: True
|
DisplayRadarPing: True
|
||||||
CameraActor: camera
|
CameraActor: camera
|
||||||
@@ -550,7 +549,6 @@ TMPL:
|
|||||||
IncomingSound: nuke1.aud
|
IncomingSound: nuke1.aud
|
||||||
MissileWeapon: atomic
|
MissileWeapon: atomic
|
||||||
DisplayBeacon: True
|
DisplayBeacon: True
|
||||||
BeaconDuration: -1
|
|
||||||
BeaconPoster: atomic
|
BeaconPoster: atomic
|
||||||
DisplayRadarPing: True
|
DisplayRadarPing: True
|
||||||
CameraActor: camera
|
CameraActor: camera
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ PALACEA:
|
|||||||
UnitType: orni.bomber
|
UnitType: orni.bomber
|
||||||
SelectTargetSound:
|
SelectTargetSound:
|
||||||
DisplayBeacon: True
|
DisplayBeacon: True
|
||||||
BeaconDuration: -1
|
|
||||||
CameraActor: camera
|
CameraActor: camera
|
||||||
CanPowerDown:
|
CanPowerDown:
|
||||||
DisabledOverlay:
|
DisabledOverlay:
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ PALACEH:
|
|||||||
SpawnOffset: -512,1c171,0
|
SpawnOffset: -512,1c171,0
|
||||||
DisplayBeacon: True
|
DisplayBeacon: True
|
||||||
DisplayRadarPing: True
|
DisplayRadarPing: True
|
||||||
BeaconDuration: -1
|
|
||||||
CameraActor: camera
|
CameraActor: camera
|
||||||
CanPowerDown:
|
CanPowerDown:
|
||||||
DisabledOverlay:
|
DisabledOverlay:
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ PALACEO:
|
|||||||
UnitType: orni.bomber
|
UnitType: orni.bomber
|
||||||
SelectTargetSound:
|
SelectTargetSound:
|
||||||
DisplayBeacon: True
|
DisplayBeacon: True
|
||||||
BeaconDuration: -1
|
|
||||||
CameraActor: camera
|
CameraActor: camera
|
||||||
CanPowerDown:
|
CanPowerDown:
|
||||||
DisabledOverlay:
|
DisabledOverlay:
|
||||||
|
|||||||
BIN
mods/ra/bits/lores-camicon.shp
Normal file
BIN
mods/ra/bits/lores-camicon.shp
Normal file
Binary file not shown.
BIN
mods/ra/bits/lores-pbmbicon.shp
Normal file
BIN
mods/ra/bits/lores-pbmbicon.shp
Normal file
Binary file not shown.
@@ -341,6 +341,7 @@ U2:
|
|||||||
RenderUnit:
|
RenderUnit:
|
||||||
WithShadow:
|
WithShadow:
|
||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
|
AttackBomber:
|
||||||
-Selectable:
|
-Selectable:
|
||||||
-GainsExperience:
|
-GainsExperience:
|
||||||
Contrail@1:
|
Contrail@1:
|
||||||
|
|||||||
@@ -251,7 +251,10 @@ powerproxy.parabombs:
|
|||||||
AllowMultiple: yes
|
AllowMultiple: yes
|
||||||
UnitType: badr.bomber
|
UnitType: badr.bomber
|
||||||
SelectTargetSound: slcttgt1.aud
|
SelectTargetSound: slcttgt1.aud
|
||||||
FlareActor: flare
|
QuantizedFacings: 8
|
||||||
|
DisplayBeacon: True
|
||||||
|
BeaconPoster: pbmbicon
|
||||||
|
CameraActor: camera
|
||||||
|
|
||||||
powerproxy.sonarpulse:
|
powerproxy.sonarpulse:
|
||||||
SonarPulsePower:
|
SonarPulsePower:
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ MSLO:
|
|||||||
SpawnOffset: 0,427,0
|
SpawnOffset: 0,427,0
|
||||||
DisplayTimer: True
|
DisplayTimer: True
|
||||||
DisplayBeacon: True
|
DisplayBeacon: True
|
||||||
BeaconDuration: -1
|
|
||||||
DisplayRadarPing: True
|
DisplayRadarPing: True
|
||||||
BeaconPoster: atomicon
|
BeaconPoster: atomicon
|
||||||
CameraActor: camera
|
CameraActor: camera
|
||||||
@@ -891,13 +890,19 @@ AFLD:
|
|||||||
Produces: Plane
|
Produces: Plane
|
||||||
Reservable:
|
Reservable:
|
||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
SpyPlanePower:
|
AirstrikePower:
|
||||||
Icon: spyplane
|
Icon: spyplane
|
||||||
ChargeTime: 180
|
ChargeTime: 180
|
||||||
Description: Spy Plane
|
Description: Spy Plane
|
||||||
LongDesc: Reveals an area of the map\nand cloaked enemy units.
|
LongDesc: Reveals an area of the map\nand cloaked enemy units.
|
||||||
SelectTargetSound: slcttgt1.aud
|
SelectTargetSound: slcttgt1.aud
|
||||||
EndChargeSound: spypln1.aud
|
EndChargeSound: spypln1.aud
|
||||||
|
CameraActor: camera
|
||||||
|
CameraRemoveDelay: 150
|
||||||
|
UnitType: u2
|
||||||
|
QuantizedFacings: 8
|
||||||
|
DisplayBeacon: True
|
||||||
|
BeaconPoster: camicon
|
||||||
ParatroopersPower:
|
ParatroopersPower:
|
||||||
Icon: paratroopers
|
Icon: paratroopers
|
||||||
ChargeTime: 360
|
ChargeTime: 360
|
||||||
|
|||||||
@@ -129,6 +129,14 @@ beacon:
|
|||||||
Start: 0
|
Start: 0
|
||||||
Length: *
|
Length: *
|
||||||
Offset: 0,-42
|
Offset: 0,-42
|
||||||
|
pbmbicon: lores-pbmbicon
|
||||||
|
Start: 0
|
||||||
|
Length: *
|
||||||
|
Offset: 0,-42
|
||||||
|
camicon: lores-camicon
|
||||||
|
Start: 0
|
||||||
|
Length: *
|
||||||
|
Offset: 0,-42
|
||||||
clock: beaconclock
|
clock: beaconclock
|
||||||
Start: 0
|
Start: 0
|
||||||
Length: *
|
Length: *
|
||||||
|
|||||||
Reference in New Issue
Block a user