new setting to allow unlucky paratroopers

This commit is contained in:
Matthias Mailänder
2014-06-21 17:35:04 +02:00
parent 2907273ef2
commit a38d43019a
7 changed files with 18 additions and 6 deletions

View File

@@ -99,7 +99,7 @@ namespace OpenRA.Mods.RA
plane.CancelActivity();
plane.QueueActivity(new FlyAttack(Target.FromCell(w, p)));
plane.Trait<ParaDrop>().SetLZ(p);
plane.Trait<ParaDrop>().SetLZ(p, true);
plane.Trait<Cargo>().Load(plane, crate);
}
else

View File

@@ -24,6 +24,9 @@ namespace OpenRA.Mods.RA
public readonly string ChuteSound = "chute1.aud";
public readonly bool EjectInAir = false;
public readonly bool EjectOnGround = false;
[Desc("Risks stuck units when they don't have the Paratrooper trait.")]
public readonly bool AllowUnsuitableCell = false;
}
public class EjectOnDeath : INotifyKilled
@@ -47,7 +50,7 @@ namespace OpenRA.Mods.RA
new TypeDictionary { new OwnerInit(self.Owner), new LocationInit(self.Location) });
if (IsSuitableCell(self, pilot))
if (info.AllowUnsuitableCell || IsSuitableCell(self, pilot))
{
if (cp.Z > 0)
{

View File

@@ -24,13 +24,15 @@ namespace OpenRA.Mods.RA
public class ParaDrop : ITick
{
bool checkForSuitableCell;
readonly List<CPos> droppedAt = new List<CPos>();
CPos lz;
public void SetLZ(CPos lz)
public void SetLZ(CPos lz, bool checkLandingCell)
{
this.lz = lz;
droppedAt.Clear();
checkForSuitableCell = checkLandingCell;
}
public void Tick(Actor self)
@@ -45,7 +47,7 @@ namespace OpenRA.Mods.RA
FinishedDropping(self);
else
{
if (!IsSuitableCell(cargo.Peek(self), self.Location))
if (checkForSuitableCell && !IsSuitableCell(cargo.Peek(self), self.Location))
return;
// unload a dude here

View File

@@ -56,7 +56,7 @@ namespace OpenRA.Mods.RA.Scripting
[Desc("Command transport to paradrop passengers near the target cell.")]
public void Paradrop(CPos cell)
{
paradrop.SetLZ(cell);
paradrop.SetLZ(cell, true);
self.QueueActivity(new FlyAttack(Target.FromCell(self.World, cell)));
}
}

View File

@@ -27,6 +27,9 @@ namespace OpenRA.Mods.RA
[Desc("In game ticks. Default value equates to 2 minutes.")]
public readonly int FlareTime = 25 * 60 * 2;
[Desc("Risks stuck units when they don't have the Paratrooper trait.")]
public readonly bool AllowImpassableCells = false;
public override object Create(ActorInitializer init) { return new ParatroopersPower(init.self, this); }
}
@@ -66,7 +69,7 @@ namespace OpenRA.Mods.RA
a.CancelActivity();
a.QueueActivity(new FlyAttack(Target.FromOrder(self.World, order)));
a.Trait<ParaDrop>().SetLZ(order.TargetLocation);
a.Trait<ParaDrop>().SetLZ(order.TargetLocation, !info.AllowImpassableCells);
var cargo = a.Trait<Cargo>();
foreach (var i in items)