Fix Resupply regression
The work-around was originally written with ground units in mind and caused issues with aircraft.
This commit is contained in:
@@ -76,18 +76,29 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
public override bool Tick(Actor self)
|
public override bool Tick(Actor self)
|
||||||
{
|
{
|
||||||
// HACK: If the activity is cancelled while we're already resupplying (or about to start resupplying),
|
// HACK: If the activity is cancelled while we're already resupplying (or about to start resupplying),
|
||||||
// move actor outside the resupplier footprint
|
// move actor outside the resupplier footprint.
|
||||||
// TODO: This check is nowhere near robust enough, and should be rewritten
|
// TODO: This check is nowhere near robust enough, and should be rewritten.
|
||||||
if (IsCanceling && host.IsInRange(self.CenterPosition, closeEnough))
|
if (IsCanceling && host.IsInRange(self.CenterPosition, closeEnough))
|
||||||
{
|
{
|
||||||
QueueChild(self.Trait<IMove>().MoveToTarget(self, host));
|
|
||||||
foreach (var notifyResupply in notifyResupplies)
|
foreach (var notifyResupply in notifyResupplies)
|
||||||
notifyResupply.ResupplyTick(host.Actor, self, ResupplyType.None);
|
notifyResupply.ResupplyTick(host.Actor, self, ResupplyType.None);
|
||||||
|
|
||||||
|
var aircraft = self.TraitOrDefault<Aircraft>();
|
||||||
|
if (aircraft != null)
|
||||||
|
{
|
||||||
|
aircraft.AllowYieldingReservation();
|
||||||
|
if (aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.TakeOffOnResupply))
|
||||||
|
Queue(new TakeOff(self));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (self.Info.HasTraitInfo<MobileInfo>())
|
||||||
|
{
|
||||||
|
QueueChild(self.Trait<IMove>().MoveToTarget(self, host));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (IsCanceling || host.Type == TargetType.Invalid
|
else if (IsCanceling || host.Type == TargetType.Invalid
|
||||||
|| (closeEnough.LengthSquared > 0 && !host.IsInRange(self.CenterPosition, closeEnough)))
|
|| (closeEnough.LengthSquared > 0 && !host.IsInRange(self.CenterPosition, closeEnough)))
|
||||||
{
|
{
|
||||||
// This is necessary to ensure host resupply actions (like animations) finish properly
|
// This is necessary to ensure host resupply actions (like animations) finish properly
|
||||||
|
|||||||
Reference in New Issue
Block a user