normalize the handling of flares in paradrop and airstrike cases

This commit is contained in:
Chris Forbes
2011-03-02 23:05:58 +13:00
parent 9b2fe9fead
commit d1b632a4a0
4 changed files with 131 additions and 141 deletions

View File

@@ -10,8 +10,7 @@
using OpenRA.FileFormats;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Air;
using OpenRA.Orders;
using OpenRA.Mods.RA.Air;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
@@ -21,7 +20,9 @@ namespace OpenRA.Mods.RA
[ActorReference]
public readonly string UnitType = "badr.bomber";
[ActorReference]
public readonly string FlareType = null;
public readonly string FlareType = null;
public readonly int FlareTime = 25 * 60 * 2; // 2 minutes
public override object Create(ActorInitializer init) { return new AirstrikePower(init.self, this); }
}
@@ -39,7 +40,13 @@ namespace OpenRA.Mods.RA
{
new LocationInit( order.TargetLocation ),
new OwnerInit( self.Owner ),
}) : null;
}) : null;
if (flare != null)
{
flare.QueueActivity(new Wait(info.FlareTime));
flare.QueueActivity(new RemoveSelf());
}
var a = w.CreateActor(info.UnitType, new TypeDictionary
{

View File

@@ -6,13 +6,12 @@
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using OpenRA.Mods.RA.Activities;
using OpenRA.Orders;
#endregion
using OpenRA.FileFormats;
using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Air;
using OpenRA.Traits;
using OpenRA.FileFormats;
using OpenRA.Mods.RA.Air;
namespace OpenRA.Mods.RA
{
@@ -23,7 +22,9 @@ namespace OpenRA.Mods.RA
[ActorReference]
public string UnitType = "badr";
[ActorReference]
public string FlareType = "flare";
public string FlareType = "flare";
public readonly int FlareTime = 25 * 60 * 2; // 2 minutes
public override object Create(ActorInitializer init) { return new ParatroopersPower(init.self, this); }
}
@@ -44,7 +45,13 @@ namespace OpenRA.Mods.RA
{
new LocationInit( order.TargetLocation ),
new OwnerInit( self.Owner ),
}) : null;
}) : null;
if (flare != null)
{
flare.QueueActivity(new Wait(info.FlareTime));
flare.QueueActivity(new RemoveSelf());
}
var a = w.CreateActor(info.UnitType, new TypeDictionary
{
@@ -56,7 +63,7 @@ namespace OpenRA.Mods.RA
a.CancelActivity();
a.QueueActivity(new FlyCircle(order.TargetLocation));
a.Trait<ParaDrop>().SetLZ(order.TargetLocation, flare);
a.Trait<ParaDrop>().SetLZ(order.TargetLocation);
var cargo = a.Trait<Cargo>();
foreach (var i in items)