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.CancelActivity();
plane.QueueActivity(new FlyAttack(Target.FromCell(w, p))); 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); plane.Trait<Cargo>().Load(plane, crate);
} }
else else

View File

@@ -24,6 +24,9 @@ namespace OpenRA.Mods.RA
public readonly string ChuteSound = "chute1.aud"; public readonly string ChuteSound = "chute1.aud";
public readonly bool EjectInAir = false; public readonly bool EjectInAir = false;
public readonly bool EjectOnGround = 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 public class EjectOnDeath : INotifyKilled
@@ -47,7 +50,7 @@ namespace OpenRA.Mods.RA
new TypeDictionary { new OwnerInit(self.Owner), new LocationInit(self.Location) }); new TypeDictionary { new OwnerInit(self.Owner), new LocationInit(self.Location) });
if (IsSuitableCell(self, pilot)) if (info.AllowUnsuitableCell || IsSuitableCell(self, pilot))
{ {
if (cp.Z > 0) if (cp.Z > 0)
{ {

View File

@@ -24,13 +24,15 @@ namespace OpenRA.Mods.RA
public class ParaDrop : ITick public class ParaDrop : ITick
{ {
bool checkForSuitableCell;
readonly List<CPos> droppedAt = new List<CPos>(); readonly List<CPos> droppedAt = new List<CPos>();
CPos lz; CPos lz;
public void SetLZ(CPos lz) public void SetLZ(CPos lz, bool checkLandingCell)
{ {
this.lz = lz; this.lz = lz;
droppedAt.Clear(); droppedAt.Clear();
checkForSuitableCell = checkLandingCell;
} }
public void Tick(Actor self) public void Tick(Actor self)
@@ -45,7 +47,7 @@ namespace OpenRA.Mods.RA
FinishedDropping(self); FinishedDropping(self);
else else
{ {
if (!IsSuitableCell(cargo.Peek(self), self.Location)) if (checkForSuitableCell && !IsSuitableCell(cargo.Peek(self), self.Location))
return; return;
// unload a dude here // 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.")] [Desc("Command transport to paradrop passengers near the target cell.")]
public void Paradrop(CPos cell) public void Paradrop(CPos cell)
{ {
paradrop.SetLZ(cell); paradrop.SetLZ(cell, true);
self.QueueActivity(new FlyAttack(Target.FromCell(self.World, cell))); 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.")] [Desc("In game ticks. Default value equates to 2 minutes.")]
public readonly int FlareTime = 25 * 60 * 2; 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); } public override object Create(ActorInitializer init) { return new ParatroopersPower(init.self, this); }
} }
@@ -66,7 +69,7 @@ namespace OpenRA.Mods.RA
a.CancelActivity(); a.CancelActivity();
a.QueueActivity(new FlyAttack(Target.FromOrder(self.World, order))); 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>(); var cargo = a.Trait<Cargo>();
foreach (var i in items) foreach (var i in items)

View File

@@ -43,6 +43,7 @@
SuccessRate: 20 SuccessRate: 20
EjectOnGround: yes EjectOnGround: yes
EjectInAir: no EjectInAir: no
AllowUnsuitableCell: no
Huntable: Huntable:
LuaScriptEvents: LuaScriptEvents:
Demolishable: Demolishable:
@@ -99,6 +100,7 @@
SuccessRate: 20 SuccessRate: 20
EjectOnGround: yes EjectOnGround: yes
EjectInAir: no EjectInAir: no
AllowUnsuitableCell: no
Huntable: Huntable:
LuaScriptEvents: LuaScriptEvents:
Demolishable: Demolishable:
@@ -235,6 +237,7 @@
SuccessRate: 50 SuccessRate: 50
EjectOnGround: no EjectOnGround: no
EjectInAir: yes EjectInAir: yes
AllowUnsuitableCell: yes
GivesBounty: GivesBounty:
GpsDot: GpsDot:
String: Plane String: Plane

View File

@@ -905,6 +905,7 @@ AFLD:
LongDesc: A Badger drops a squad of infantry\nanywhere on the map. LongDesc: A Badger drops a squad of infantry\nanywhere on the map.
DropItems: E1,E1,E1,E3,E3 DropItems: E1,E1,E1,E3,E3
SelectTargetSound: slcttgt1.aud SelectTargetSound: slcttgt1.aud
AllowImpassableCells: false
ProductionBar: ProductionBar:
SupportPowerChargeBar: SupportPowerChargeBar:
PrimaryBuilding: PrimaryBuilding: