From a38d43019abcfae4a74cfa09cb5c80e9fda94020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 21 Jun 2014 17:35:04 +0200 Subject: [PATCH] new setting to allow unlucky paratroopers --- OpenRA.Mods.RA/CrateSpawner.cs | 2 +- OpenRA.Mods.RA/EjectOnDeath.cs | 5 ++++- OpenRA.Mods.RA/ParaDrop.cs | 6 ++++-- OpenRA.Mods.RA/Scripting/Properties/TransportProperties.cs | 2 +- OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs | 5 ++++- mods/ra/rules/defaults.yaml | 3 +++ mods/ra/rules/structures.yaml | 1 + 7 files changed, 18 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.RA/CrateSpawner.cs b/OpenRA.Mods.RA/CrateSpawner.cs index 938c089f40..bd95dc0abe 100644 --- a/OpenRA.Mods.RA/CrateSpawner.cs +++ b/OpenRA.Mods.RA/CrateSpawner.cs @@ -99,7 +99,7 @@ namespace OpenRA.Mods.RA plane.CancelActivity(); plane.QueueActivity(new FlyAttack(Target.FromCell(w, p))); - plane.Trait().SetLZ(p); + plane.Trait().SetLZ(p, true); plane.Trait().Load(plane, crate); } else diff --git a/OpenRA.Mods.RA/EjectOnDeath.cs b/OpenRA.Mods.RA/EjectOnDeath.cs index 31cf09fe9d..94e501ff14 100644 --- a/OpenRA.Mods.RA/EjectOnDeath.cs +++ b/OpenRA.Mods.RA/EjectOnDeath.cs @@ -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) { diff --git a/OpenRA.Mods.RA/ParaDrop.cs b/OpenRA.Mods.RA/ParaDrop.cs index 08a7ca1540..ab6af54edb 100644 --- a/OpenRA.Mods.RA/ParaDrop.cs +++ b/OpenRA.Mods.RA/ParaDrop.cs @@ -24,13 +24,15 @@ namespace OpenRA.Mods.RA public class ParaDrop : ITick { + bool checkForSuitableCell; readonly List droppedAt = new List(); 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 diff --git a/OpenRA.Mods.RA/Scripting/Properties/TransportProperties.cs b/OpenRA.Mods.RA/Scripting/Properties/TransportProperties.cs index 8819cf94d2..c4ce0967bb 100644 --- a/OpenRA.Mods.RA/Scripting/Properties/TransportProperties.cs +++ b/OpenRA.Mods.RA/Scripting/Properties/TransportProperties.cs @@ -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))); } } diff --git a/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs index 8076e8f2b1..46f13bc778 100644 --- a/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.RA/SupportPowers/ParatroopersPower.cs @@ -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().SetLZ(order.TargetLocation); + a.Trait().SetLZ(order.TargetLocation, !info.AllowImpassableCells); var cargo = a.Trait(); foreach (var i in items) diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 5cdfce8f49..ab675e7652 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -43,6 +43,7 @@ SuccessRate: 20 EjectOnGround: yes EjectInAir: no + AllowUnsuitableCell: no Huntable: LuaScriptEvents: Demolishable: @@ -99,6 +100,7 @@ SuccessRate: 20 EjectOnGround: yes EjectInAir: no + AllowUnsuitableCell: no Huntable: LuaScriptEvents: Demolishable: @@ -235,6 +237,7 @@ SuccessRate: 50 EjectOnGround: no EjectInAir: yes + AllowUnsuitableCell: yes GivesBounty: GpsDot: String: Plane diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index c2f5f9d5c8..82ad7a130a 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -905,6 +905,7 @@ AFLD: LongDesc: A Badger drops a squad of infantry\nanywhere on the map. DropItems: E1,E1,E1,E3,E3 SelectTargetSound: slcttgt1.aud + AllowImpassableCells: false ProductionBar: SupportPowerChargeBar: PrimaryBuilding: