normalize the handling of flares in paradrop and airstrike cases
This commit is contained in:
@@ -82,7 +82,7 @@ namespace OpenRA.Mods.RA
|
||||
});
|
||||
plane.CancelActivity();
|
||||
plane.QueueActivity(new FlyCircle(p));
|
||||
plane.Trait<ParaDrop>().SetLZ(p, null);
|
||||
plane.Trait<ParaDrop>().SetLZ(p);
|
||||
plane.Trait<Cargo>().Load(plane, crate);
|
||||
});
|
||||
return;
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Air;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Mods.RA.Air;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
@@ -22,16 +22,14 @@ namespace OpenRA.Mods.RA
|
||||
public readonly string ChuteSound = "chute1.aud";
|
||||
}
|
||||
|
||||
public class ParaDrop : ITick, INotifyDamage
|
||||
public class ParaDrop : ITick
|
||||
{
|
||||
readonly List<int2> droppedAt = new List<int2>();
|
||||
int2 lz;
|
||||
Actor flare;
|
||||
|
||||
public void SetLZ( int2 lz, Actor flare )
|
||||
public void SetLZ(int2 lz)
|
||||
{
|
||||
this.lz = lz;
|
||||
this.flare = flare;
|
||||
droppedAt.Clear();
|
||||
}
|
||||
|
||||
@@ -77,28 +75,6 @@ namespace OpenRA.Mods.RA
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new FlyOffMap { Interruptible = false });
|
||||
self.QueueActivity(new RemoveSelf());
|
||||
|
||||
if (flare != null)
|
||||
{
|
||||
flare.CancelActivity();
|
||||
flare.QueueActivity(new Wait(300));
|
||||
flare.QueueActivity(new RemoveSelf());
|
||||
flare = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Damaged(Actor self, AttackInfo e)
|
||||
{
|
||||
if (e.DamageStateChanged && e.DamageState == DamageState.Dead)
|
||||
{
|
||||
if (flare != null)
|
||||
{
|
||||
flare.CancelActivity();
|
||||
flare.QueueActivity(new Wait(300));
|
||||
flare.QueueActivity(new RemoveSelf());
|
||||
flare = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Air;
|
||||
using OpenRA.Orders;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
@@ -23,6 +22,8 @@ namespace OpenRA.Mods.RA
|
||||
[ActorReference]
|
||||
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); }
|
||||
}
|
||||
|
||||
@@ -41,6 +42,12 @@ namespace OpenRA.Mods.RA
|
||||
new OwnerInit( self.Owner ),
|
||||
}) : null;
|
||||
|
||||
if (flare != null)
|
||||
{
|
||||
flare.QueueActivity(new Wait(info.FlareTime));
|
||||
flare.QueueActivity(new RemoveSelf());
|
||||
}
|
||||
|
||||
var a = w.CreateActor(info.UnitType, new TypeDictionary
|
||||
{
|
||||
new LocationInit( startPos ),
|
||||
|
||||
@@ -8,11 +8,10 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Orders;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Air;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
@@ -25,6 +24,8 @@ namespace OpenRA.Mods.RA
|
||||
[ActorReference]
|
||||
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); }
|
||||
}
|
||||
|
||||
@@ -46,6 +47,12 @@ namespace OpenRA.Mods.RA
|
||||
new OwnerInit( self.Owner ),
|
||||
}) : null;
|
||||
|
||||
if (flare != null)
|
||||
{
|
||||
flare.QueueActivity(new Wait(info.FlareTime));
|
||||
flare.QueueActivity(new RemoveSelf());
|
||||
}
|
||||
|
||||
var a = w.CreateActor(info.UnitType, new TypeDictionary
|
||||
{
|
||||
new LocationInit( startPos ),
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user