fix crates being dropped in stupid locations
This commit is contained in:
@@ -82,7 +82,7 @@ namespace OpenRA.Mods.RA_NG
|
|||||||
plane.traits.Get<Unit>().Facing = Util.GetFacing(p - startPos, 0);
|
plane.traits.Get<Unit>().Facing = Util.GetFacing(p - startPos, 0);
|
||||||
plane.CancelActivity();
|
plane.CancelActivity();
|
||||||
plane.QueueActivity(new FlyCircle(p));
|
plane.QueueActivity(new FlyCircle(p));
|
||||||
plane.traits.Get<ParaDrop>().SetLZ(p, null);
|
plane.traits.Get<ParaDrop>().SetLZ(p, null, inWater);
|
||||||
plane.traits.Get<Cargo>().Load(plane, crate);
|
plane.traits.Get<Cargo>().Load(plane, crate);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ using System.Collections.Generic;
|
|||||||
using OpenRA.Mods.RA.Effects;
|
using OpenRA.Mods.RA.Effects;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Traits.Activities;
|
using OpenRA.Traits.Activities;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
using OpenRA.GameRules;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
@@ -36,11 +38,13 @@ namespace OpenRA.Mods.RA
|
|||||||
readonly List<int2> droppedAt = new List<int2>();
|
readonly List<int2> droppedAt = new List<int2>();
|
||||||
int2 lz;
|
int2 lz;
|
||||||
Actor flare;
|
Actor flare;
|
||||||
|
bool waterDrop;
|
||||||
|
|
||||||
public void SetLZ( int2 lz, Actor flare )
|
public void SetLZ( int2 lz, Actor flare, bool waterDrop )
|
||||||
{
|
{
|
||||||
this.lz = lz;
|
this.lz = lz;
|
||||||
this.flare = flare;
|
this.flare = flare;
|
||||||
|
this.waterDrop = waterDrop;
|
||||||
droppedAt.Clear();
|
droppedAt.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +54,8 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
if ((self.Location - lz).LengthSquared <= r * r && !droppedAt.Contains(self.Location))
|
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
|
// unload a dude here
|
||||||
droppedAt.Add(self.Location);
|
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)
|
void FinishedDropping(Actor self)
|
||||||
{
|
{
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
a.CancelActivity();
|
a.CancelActivity();
|
||||||
a.QueueActivity(new FlyCircle(p));
|
a.QueueActivity(new FlyCircle(p));
|
||||||
a.traits.Get<ParaDrop>().SetLZ(p, flare);
|
a.traits.Get<ParaDrop>().SetLZ(p, flare, false);
|
||||||
|
|
||||||
var cargo = a.traits.Get<Cargo>();
|
var cargo = a.traits.Get<Cargo>();
|
||||||
foreach (var i in items)
|
foreach (var i in items)
|
||||||
|
|||||||
Reference in New Issue
Block a user