Don't exit FlyOffMap immediately on leaving map
Usually they'll get removed afterwards, so they need to be out of players' sight before ending this activity.
This commit is contained in:
@@ -20,17 +20,18 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
readonly Aircraft aircraft;
|
readonly Aircraft aircraft;
|
||||||
readonly Target target;
|
readonly Target target;
|
||||||
readonly bool hasTarget;
|
readonly bool hasTarget;
|
||||||
|
int endingDelay;
|
||||||
|
|
||||||
public FlyOffMap(Actor self)
|
public FlyOffMap(Actor self, int endingDelay = 25)
|
||||||
{
|
{
|
||||||
aircraft = self.Trait<Aircraft>();
|
aircraft = self.Trait<Aircraft>();
|
||||||
ChildHasPriority = false;
|
ChildHasPriority = false;
|
||||||
|
this.endingDelay = endingDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlyOffMap(Actor self, Target target)
|
public FlyOffMap(Actor self, Target target, int endingDelay = 25)
|
||||||
|
: this(self, endingDelay)
|
||||||
{
|
{
|
||||||
aircraft = self.Trait<Aircraft>();
|
|
||||||
ChildHasPriority = false;
|
|
||||||
this.target = target;
|
this.target = target;
|
||||||
hasTarget = true;
|
hasTarget = true;
|
||||||
}
|
}
|
||||||
@@ -40,6 +41,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (hasTarget)
|
if (hasTarget)
|
||||||
{
|
{
|
||||||
QueueChild(new Fly(self, target));
|
QueueChild(new Fly(self, target));
|
||||||
|
QueueChild(new FlyTimed(-1, self));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,14 +56,14 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
// Refuse to take off if it would land immediately again.
|
// Refuse to take off if it would land immediately again.
|
||||||
if (aircraft.ForceLanding)
|
if (aircraft.ForceLanding)
|
||||||
{
|
|
||||||
Cancel(self);
|
Cancel(self);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsCanceling || !self.World.Map.Contains(self.Location))
|
if (IsCanceling)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (!self.World.Map.Contains(self.Location) && --endingDelay < 0)
|
||||||
|
ChildActivity.Cancel(self);
|
||||||
|
|
||||||
return TickChild(self);
|
return TickChild(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user