diff --git a/OpenRA.Mods.RA-NG/CrateDrop.cs b/OpenRA.Mods.RA-NG/CrateDrop.cs index 2334025425..4c463f7d71 100644 --- a/OpenRA.Mods.RA-NG/CrateDrop.cs +++ b/OpenRA.Mods.RA-NG/CrateDrop.cs @@ -82,7 +82,7 @@ namespace OpenRA.Mods.RA_NG plane.traits.Get().Facing = Util.GetFacing(p - startPos, 0); plane.CancelActivity(); plane.QueueActivity(new FlyCircle(p)); - plane.traits.Get().SetLZ(p, null); + plane.traits.Get().SetLZ(p, null, inWater); plane.traits.Get().Load(plane, crate); }); return; diff --git a/OpenRA.Mods.RA/ParaDrop.cs b/OpenRA.Mods.RA/ParaDrop.cs index 4184c05831..77fdf7a2a1 100644 --- a/OpenRA.Mods.RA/ParaDrop.cs +++ b/OpenRA.Mods.RA/ParaDrop.cs @@ -22,6 +22,8 @@ using System.Collections.Generic; using OpenRA.Mods.RA.Effects; using OpenRA.Traits; using OpenRA.Traits.Activities; +using OpenRA.FileFormats; +using OpenRA.GameRules; namespace OpenRA.Mods.RA { @@ -36,11 +38,13 @@ namespace OpenRA.Mods.RA readonly List droppedAt = new List(); int2 lz; Actor flare; + bool waterDrop; - public void SetLZ( int2 lz, Actor flare ) + public void SetLZ( int2 lz, Actor flare, bool waterDrop ) { this.lz = lz; this.flare = flare; + this.waterDrop = waterDrop; droppedAt.Clear(); } @@ -50,7 +54,8 @@ namespace OpenRA.Mods.RA if ((self.Location - lz).LengthSquared <= r * r && !droppedAt.Contains(self.Location)) { - // todo: check is this is a good drop cell. + if (!IsSuitableCell(self, self.Location)) + return; // unload a dude here droppedAt.Add(self.Location); @@ -73,6 +78,12 @@ namespace OpenRA.Mods.RA } } + bool IsSuitableCell(Actor self, int2 p) + { + // rude hack + return self.World.IsCellBuildable(p, waterDrop); + } + void FinishedDropping(Actor self) { self.CancelActivity(); diff --git a/OpenRA.Mods.RA/ParatroopersPower.cs b/OpenRA.Mods.RA/ParatroopersPower.cs index a9c6edb5d1..b8b93017b3 100644 --- a/OpenRA.Mods.RA/ParatroopersPower.cs +++ b/OpenRA.Mods.RA/ParatroopersPower.cs @@ -67,7 +67,7 @@ namespace OpenRA.Mods.RA a.CancelActivity(); a.QueueActivity(new FlyCircle(p)); - a.traits.Get().SetLZ(p, flare); + a.traits.Get().SetLZ(p, flare, false); var cargo = a.traits.Get(); foreach (var i in items)