Make NukePower use RevealShroudEffect instead of camera actor

Additionally, remove the DelayedAction and let the beacon remove itself
instead.
This commit is contained in:
reaperrr
2016-11-05 21:27:38 +01:00
parent 79add6113c
commit 079908d238
5 changed files with 15 additions and 27 deletions

View File

@@ -54,9 +54,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Amount of time before detonation to remove the beacon")] [Desc("Amount of time before detonation to remove the beacon")]
public readonly int BeaconRemoveAdvance = 25; public readonly int BeaconRemoveAdvance = 25;
[ActorReference] [Desc("Range of cells the camera should reveal around target cell.")]
[Desc("Actor to spawn before detonation")] public readonly WDist CameraRange = WDist.Zero;
public readonly string CameraActor = null;
[Desc("Reveal cells to players with these stances only.")]
public readonly Stance CameraStances = Stance.Ally;
[Desc("Amount of time before detonation to spawn the camera")] [Desc("Amount of time before detonation to spawn the camera")]
public readonly int CameraSpawnAdvance = 25; public readonly int CameraSpawnAdvance = 25;
@@ -114,19 +116,10 @@ namespace OpenRA.Mods.Common.Traits
self.World.AddFrameEndTask(w => w.Add(missile)); self.World.AddFrameEndTask(w => w.Add(missile));
if (info.CameraActor != null) if (info.CameraRange != WDist.Zero)
{ {
var camera = self.World.CreateActor(false, info.CameraActor, new TypeDictionary self.World.AddFrameEndTask(w => w.Add(new RevealShroudEffect(targetPosition, info.CameraRange, Shroud.SourceType.Visibility, self.Owner, info.CameraStances,
{ info.FlightDelay - info.CameraSpawnAdvance, info.CameraSpawnAdvance + info.CameraRemoveDelay)));
new LocationInit(order.TargetLocation),
new OwnerInit(self.Owner),
});
camera.QueueActivity(new Wait(info.CameraSpawnAdvance + info.CameraRemoveDelay));
camera.QueueActivity(new RemoveSelf());
Action addCamera = () => self.World.AddFrameEndTask(w => w.Add(camera));
self.World.AddFrameEndTask(w => w.Add(new DelayedAction(info.FlightDelay - info.CameraSpawnAdvance, addCamera)));
} }
if (Info.DisplayBeacon) if (Info.DisplayBeacon)
@@ -142,18 +135,13 @@ namespace OpenRA.Mods.Common.Traits
Info.ArrowSequence, Info.ArrowSequence,
Info.CircleSequence, Info.CircleSequence,
Info.ClockSequence, Info.ClockSequence,
() => missile.FractionComplete); () => missile.FractionComplete,
Info.BeaconDelay,
Action removeBeacon = () => self.World.AddFrameEndTask(w => info.FlightDelay - info.BeaconRemoveAdvance);
{
w.Remove(beacon);
beacon = null;
});
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
w.Add(beacon); w.Add(beacon);
w.Add(new DelayedAction(info.FlightDelay - info.BeaconRemoveAdvance, removeBeacon));
}); });
} }
} }

View File

@@ -633,7 +633,7 @@ TMPL:
BeaconPoster: atomic BeaconPoster: atomic
BeaconPosterPalette: beaconposter BeaconPosterPalette: beaconposter
DisplayRadarPing: True DisplayRadarPing: True
CameraActor: camera CameraRange: 10c0
SupportPowerChargeBar: SupportPowerChargeBar:
Power: Power:
Amount: -150 Amount: -150

View File

@@ -951,7 +951,7 @@ palace:
SpawnOffset: -512,1c171,0 SpawnOffset: -512,1c171,0
DisplayBeacon: True DisplayBeacon: True
DisplayRadarPing: True DisplayRadarPing: True
CameraActor: camera CameraRange: 10c0
ActivationSequence: ActivationSequence:
ProduceActorPower@fremen: ProduceActorPower@fremen:
Description: Recruit Fremen Description: Recruit Fremen

View File

@@ -36,8 +36,8 @@ MSLO:
DisplayBeacon: True DisplayBeacon: True
DisplayRadarPing: True DisplayRadarPing: True
BeaconPoster: atomicon BeaconPoster: atomicon
CameraActor: camera
FlashType: Nuke FlashType: Nuke
CameraRange: 10c0
CanPowerDown: CanPowerDown:
PowerupSound: EnablePower PowerupSound: EnablePower
PowerdownSound: DisablePower PowerdownSound: DisablePower

View File

@@ -272,6 +272,6 @@ NAMISL:
DisplayBeacon: False DisplayBeacon: False
DisplayRadarPing: True DisplayRadarPing: True
BeaconPoster: BeaconPoster:
CameraActor: camera CameraRange: 10c0
SelectionDecorations: SelectionDecorations:
VisualBounds: 75,48 VisualBounds: 75,48