Add a camera to the Ion Cannon. Fixes #5058.

This commit is contained in:
Paul Chote
2014-04-06 17:18:43 +12:00
parent c5ccb0ef4a
commit 14eab38f0b
3 changed files with 34 additions and 3 deletions

View File

@@ -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,
@@ -10,11 +10,21 @@
using OpenRA.Mods.Cnc.Effects; using OpenRA.Mods.Cnc.Effects;
using OpenRA.Mods.RA; using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Cnc namespace OpenRA.Mods.Cnc
{ {
class IonCannonPowerInfo : SupportPowerInfo class IonCannonPowerInfo : SupportPowerInfo
{ {
[ActorReference]
[Desc("Actor to spawn when the attack starts")]
public readonly string CameraActor = null;
[Desc("Amount of time to keep the camera alive")]
public readonly int CameraRemoveDelay = 25;
public override object Create(ActorInitializer init) { return new IonCannonPower(init.self, this); } public override object Create(ActorInitializer init) { return new IonCannonPower(init.self, this); }
} }
@@ -34,8 +44,21 @@ namespace OpenRA.Mods.Cnc
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {
var info = Info as IonCannonPowerInfo;
Sound.Play(Info.LaunchSound, order.TargetLocation.CenterPosition); Sound.Play(Info.LaunchSound, order.TargetLocation.CenterPosition);
w.Add(new IonCannon(self, w, order.TargetLocation)); w.Add(new IonCannon(self, w, order.TargetLocation));
if (info.CameraActor == null)
return;
var camera = w.CreateActor(info.CameraActor, new TypeDictionary
{
new LocationInit(order.TargetLocation),
new OwnerInit(self.Owner),
});
camera.QueueActivity(new Wait(info.CameraRemoveDelay));
camera.QueueActivity(new RemoveSelf());
}); });
} }
} }

View File

@@ -49,7 +49,14 @@ CAMERA:
HP: 1000 HP: 1000
RevealsShroud: RevealsShroud:
Range: 10c0 Range: 10c0
ProximityCaptor: BodyOrientation:
Types: Camera
CAMERA.small:
Immobile:
OccupiesSpace: false
Health:
HP: 1000
RevealsShroud:
Range: 6c0
BodyOrientation: BodyOrientation:

View File

@@ -456,6 +456,7 @@ EYE:
SelectTargetSound: select1.aud SelectTargetSound: select1.aud
InsufficientPowerSound: nopower1.aud InsufficientPowerSound: nopower1.aud
DisplayRadarPing: True DisplayRadarPing: True
CameraActor: camera.small
SupportPowerChargeBar: SupportPowerChargeBar:
TMPL: TMPL: