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
/*
* 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
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
@@ -10,11 +10,21 @@
using OpenRA.Mods.Cnc.Effects;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.Cnc
{
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); }
}
@@ -34,8 +44,21 @@ namespace OpenRA.Mods.Cnc
self.World.AddFrameEndTask(w =>
{
var info = Info as IonCannonPowerInfo;
Sound.Play(Info.LaunchSound, order.TargetLocation.CenterPosition);
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());
});
}
}