Make nuke flight time independent from map size.

This commit is contained in:
Paul Chote
2014-04-06 19:40:00 +12:00
parent 14eab38f0b
commit 51363fd724
2 changed files with 57 additions and 32 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,
@@ -8,7 +8,11 @@
*/
#endregion
using System;
using OpenRA.Effects;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Effects;
using OpenRA.Primitives;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
@@ -19,6 +23,15 @@ namespace OpenRA.Mods.RA
public readonly string MissileWeapon = "";
public readonly WVec SpawnOffset = WVec.Zero;
[Desc("Travel time - split equally between ascent and descent")]
public readonly int FlightDelay = 400;
[Desc("Visual ascent velocity in WRange / tick")]
public readonly WRange FlightVelocity = new WRange(512);
[Desc("Descend immediately on the target, with half the FlightDelay")]
public readonly bool SkipAscent = false;
public override object Create(ActorInitializer init) { return new NukePower(init.self, this); }
}
@@ -50,8 +63,11 @@ namespace OpenRA.Mods.RA
var npi = Info as NukePowerInfo;
var rb = self.Trait<RenderSimple>();
rb.PlayCustomAnim(self, "active");
self.World.AddFrameEndTask(w => w.Add(
new NukeLaunch(self.Owner, self, npi.MissileWeapon, self.CenterPosition + body.LocalToWorld(npi.SpawnOffset), order.TargetLocation)));
self.World.AddFrameEndTask(w => w.Add(new NukeLaunch(self, npi.MissileWeapon,
self.CenterPosition + body.LocalToWorld(npi.SpawnOffset),
order.TargetLocation.CenterPosition,
npi.FlightVelocity, npi.FlightDelay, npi.SkipAscent)));
}
}
}