Remove airstrike beacon when the attack begins.
This commit is contained in:
@@ -28,8 +28,10 @@ namespace OpenRA.Mods.Cnc
|
|||||||
return new SelectGenericPowerTarget(order, manager, "ioncannon", MouseButton.Left);
|
return new SelectGenericPowerTarget(order, manager, "ioncannon", MouseButton.Left);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Activate(Actor self, Order order)
|
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||||
{
|
{
|
||||||
|
base.Activate(self, order, manager);
|
||||||
|
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
Sound.Play(Info.LaunchSound, order.TargetLocation.CenterPosition);
|
Sound.Play(Info.LaunchSound, order.TargetLocation.CenterPosition);
|
||||||
|
|||||||
@@ -50,10 +50,11 @@ namespace OpenRA.Mods.RA
|
|||||||
public AirstrikePower(Actor self, AirstrikePowerInfo info)
|
public AirstrikePower(Actor self, AirstrikePowerInfo info)
|
||||||
: base(self, info) { }
|
: base(self, info) { }
|
||||||
|
|
||||||
public override void Activate(Actor self, Order order)
|
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||||
{
|
{
|
||||||
var info = Info as AirstrikePowerInfo;
|
base.Activate(self, order, manager);
|
||||||
|
|
||||||
|
var info = Info as AirstrikePowerInfo;
|
||||||
var attackFacing = Util.QuantizeFacing(self.World.SharedRandom.Next(256), info.QuantizedFacings) * (256 / info.QuantizedFacings);
|
var attackFacing = Util.QuantizeFacing(self.World.SharedRandom.Next(256), info.QuantizedFacings) * (256 / info.QuantizedFacings);
|
||||||
var attackRotation = WRot.FromFacing(attackFacing);
|
var attackRotation = WRot.FromFacing(attackFacing);
|
||||||
var delta = new WVec(0, -1024, 0).Rotate(attackRotation);
|
var delta = new WVec(0, -1024, 0).Rotate(attackRotation);
|
||||||
@@ -69,7 +70,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
Action<Actor> onEnterRange = a =>
|
Action<Actor> onEnterRange = a =>
|
||||||
{
|
{
|
||||||
// Spawn a camera when the first plane enters the target area
|
// Spawn a camera and remove the beacon when the first plane enters the target area
|
||||||
if (info.CameraActor != null && !aircraftInRange.Any(kv => kv.Value))
|
if (info.CameraActor != null && !aircraftInRange.Any(kv => kv.Value))
|
||||||
{
|
{
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
@@ -82,6 +83,15 @@ namespace OpenRA.Mods.RA
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (beacon != null)
|
||||||
|
{
|
||||||
|
self.World.AddFrameEndTask(w =>
|
||||||
|
{
|
||||||
|
w.Remove(beacon);
|
||||||
|
beacon = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
aircraftInRange[a] = true;
|
aircraftInRange[a] = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -89,7 +99,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
aircraftInRange[a] = false;
|
aircraftInRange[a] = false;
|
||||||
|
|
||||||
// Remove the camera when the final plane leaves the target area
|
// Remove the camera and flare 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)
|
||||||
|
|||||||
@@ -34,8 +34,10 @@ namespace OpenRA.Mods.RA
|
|||||||
return new SelectTarget(order, manager, this);
|
return new SelectTarget(order, manager, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Activate(Actor self, Order order)
|
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||||
{
|
{
|
||||||
|
base.Activate(self, order, manager);
|
||||||
|
|
||||||
foreach (var target in UnitsInRange(order.ExtraLocation))
|
foreach (var target in UnitsInRange(order.ExtraLocation))
|
||||||
{
|
{
|
||||||
var cs = target.Trait<Chronoshiftable>();
|
var cs = target.Trait<Chronoshiftable>();
|
||||||
|
|||||||
@@ -97,8 +97,10 @@ namespace OpenRA.Mods.RA
|
|||||||
self.Owner.PlayerActor.Trait<SupportPowerManager>().Powers[key].Activate(new Order());
|
self.Owner.PlayerActor.Trait<SupportPowerManager>().Powers[key].Activate(new Order());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Activate(Actor self, Order order)
|
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||||
{
|
{
|
||||||
|
base.Activate(self, order, manager);
|
||||||
|
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
Sound.PlayToPlayer(self.Owner, Info.LaunchSound);
|
Sound.PlayToPlayer(self.Owner, Info.LaunchSound);
|
||||||
|
|||||||
@@ -34,8 +34,10 @@ namespace OpenRA.Mods.RA
|
|||||||
return new SelectTarget(order, manager, this);
|
return new SelectTarget(order, manager, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Activate(Actor self, Order order)
|
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||||
{
|
{
|
||||||
|
base.Activate(self, order, manager);
|
||||||
|
|
||||||
self.Trait<RenderBuilding>().PlayCustomAnim(self, "active");
|
self.Trait<RenderBuilding>().PlayCustomAnim(self, "active");
|
||||||
|
|
||||||
Sound.Play("ironcur9.aud", order.TargetLocation.CenterPosition);
|
Sound.Play("ironcur9.aud", order.TargetLocation.CenterPosition);
|
||||||
|
|||||||
@@ -38,8 +38,10 @@ namespace OpenRA.Mods.RA
|
|||||||
return new SelectGenericPowerTarget(order, manager, "nuke", MouseButton.Left);
|
return new SelectGenericPowerTarget(order, manager, "nuke", MouseButton.Left);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Activate(Actor self, Order order)
|
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||||
{
|
{
|
||||||
|
base.Activate(self, order, manager);
|
||||||
|
|
||||||
if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
||||||
Sound.Play(Info.LaunchSound);
|
Sound.Play(Info.LaunchSound);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -33,8 +33,10 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public ParatroopersPower(Actor self, ParatroopersPowerInfo info) : base(self, info) { }
|
public ParatroopersPower(Actor self, ParatroopersPowerInfo info) : base(self, info) { }
|
||||||
|
|
||||||
public override void Activate(Actor self, Order order)
|
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||||
{
|
{
|
||||||
|
base.Activate(self, order, manager);
|
||||||
|
|
||||||
var items = (Info as ParatroopersPowerInfo).DropItems;
|
var items = (Info as ParatroopersPowerInfo).DropItems;
|
||||||
var startPos = self.World.ChooseRandomEdgeCell();
|
var startPos = self.World.ChooseRandomEdgeCell();
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ namespace OpenRA.Mods.RA
|
|||||||
public class SonarPulsePower : SupportPower
|
public class SonarPulsePower : SupportPower
|
||||||
{
|
{
|
||||||
public SonarPulsePower(Actor self, SonarPulsePowerInfo info) : base(self, info) { }
|
public SonarPulsePower(Actor self, SonarPulsePowerInfo info) : base(self, info) { }
|
||||||
public override void Activate(Actor self, Order order)
|
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||||
{
|
{
|
||||||
|
base.Activate(self, order, manager);
|
||||||
|
|
||||||
// TODO: Reveal submarines
|
// TODO: Reveal submarines
|
||||||
|
|
||||||
// Should this play for all players?
|
// Should this play for all players?
|
||||||
|
|||||||
@@ -25,8 +25,10 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public SpyPlanePower(Actor self, SpyPlanePowerInfo info) : base(self, info) { }
|
public SpyPlanePower(Actor self, SpyPlanePowerInfo info) : base(self, info) { }
|
||||||
|
|
||||||
public override void Activate(Actor self, Order order)
|
public override void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||||
{
|
{
|
||||||
|
base.Activate(self, order, manager);
|
||||||
|
|
||||||
var enterCell = self.World.ChooseRandomEdgeCell();
|
var enterCell = self.World.ChooseRandomEdgeCell();
|
||||||
var altitude = Rules.Info["u2"].Traits.Get<PlaneInfo>().CruiseAltitude;
|
var altitude = Rules.Info["u2"].Traits.Get<PlaneInfo>().CruiseAltitude;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* 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
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Mods.RA.Effects;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
@@ -45,6 +46,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public readonly Actor self;
|
public readonly Actor self;
|
||||||
public readonly SupportPowerInfo Info;
|
public readonly SupportPowerInfo Info;
|
||||||
|
protected Beacon beacon;
|
||||||
|
|
||||||
public SupportPower(Actor self, SupportPowerInfo info)
|
public SupportPower(Actor self, SupportPowerInfo info)
|
||||||
{
|
{
|
||||||
@@ -62,7 +64,26 @@ namespace OpenRA.Mods.RA
|
|||||||
Sound.PlayToPlayer(self.Owner, Info.EndChargeSound);
|
Sound.PlayToPlayer(self.Owner, Info.EndChargeSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Activate(Actor self, Order order) { }
|
public virtual void Activate(Actor self, Order order, SupportPowerManager manager)
|
||||||
|
{
|
||||||
|
if (Info.DisplayBeacon)
|
||||||
|
{
|
||||||
|
beacon = new Beacon(
|
||||||
|
order.Player,
|
||||||
|
order.TargetLocation.CenterPosition,
|
||||||
|
Info.BeaconDuration,
|
||||||
|
Info.BeaconPalettePrefix);
|
||||||
|
|
||||||
|
self.World.Add(beacon);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Info.DisplayRadarPing && manager.RadarPings != null)
|
||||||
|
manager.RadarPings.Value.Add(
|
||||||
|
() => order.Player.IsAlliedWith(self.World.RenderPlayer),
|
||||||
|
order.TargetLocation.CenterPosition,
|
||||||
|
order.Player.Color.RGB,
|
||||||
|
Info.BeaconDuration);
|
||||||
|
}
|
||||||
|
|
||||||
public virtual IOrderGenerator OrderGenerator(string order, SupportPowerManager manager)
|
public virtual IOrderGenerator OrderGenerator(string order, SupportPowerManager manager)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -188,24 +188,10 @@ namespace OpenRA.Mods.RA
|
|||||||
var power = Instances.First(i => !InstanceDisabled(i));
|
var power = Instances.First(i => !InstanceDisabled(i));
|
||||||
|
|
||||||
// Note: order.Subject is the *player* actor
|
// Note: order.Subject is the *player* actor
|
||||||
power.Activate(power.self, order);
|
power.Activate(power.self, order, Manager);
|
||||||
RemainingTime = TotalTime;
|
RemainingTime = TotalTime;
|
||||||
notifiedCharging = notifiedReady = false;
|
notifiedCharging = notifiedReady = false;
|
||||||
|
|
||||||
if (power.Info.DisplayBeacon)
|
|
||||||
power.self.World.Add(new Beacon(
|
|
||||||
order.Player,
|
|
||||||
order.TargetLocation.CenterPosition,
|
|
||||||
power.Info.BeaconDuration,
|
|
||||||
power.Info.BeaconPalettePrefix));
|
|
||||||
|
|
||||||
if (power.Info.DisplayRadarPing && Manager.RadarPings != null)
|
|
||||||
Manager.RadarPings.Value.Add(
|
|
||||||
() => order.Player.IsAlliedWith(power.self.World.RenderPlayer),
|
|
||||||
order.TargetLocation.CenterPosition,
|
|
||||||
order.Player.Color.RGB,
|
|
||||||
power.Info.BeaconDuration);
|
|
||||||
|
|
||||||
if (Info.OneShot)
|
if (Info.OneShot)
|
||||||
Disabled = true;
|
Disabled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user