Replace SequenceActivities with ChildActivity in several air activities.

This commit is contained in:
tovl
2019-03-30 16:13:31 +01:00
committed by Paul Chote
parent 7fe2d1223b
commit 8ee11028d7
2 changed files with 20 additions and 4 deletions

View File

@@ -47,6 +47,13 @@ namespace OpenRA.Mods.Common.Activities
public override Activity Tick(Actor self)
{
if (ChildActivity != null)
{
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
if (ChildActivity != null)
return this;
}
// Refuse to take off if it would land immediately again.
if (aircraft.ForceLanding)
Cancel(self);
@@ -89,9 +96,8 @@ namespace OpenRA.Mods.Common.Activities
}
wasMovingWithinRange = true;
return ActivityUtils.SequenceActivities(self,
aircraft.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, targetLineColor),
this);
QueueChild(self, aircraft.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, targetLineColor), true);
return this;
}
}
}

View File

@@ -47,6 +47,13 @@ namespace OpenRA.Mods.Common.Activities
public override Activity Tick(Actor self)
{
if (ChildActivity != null)
{
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
if (ChildActivity != null)
return this;
}
// Refuse to take off if it would land immediately again.
if (aircraft.ForceLanding)
Cancel(self);
@@ -75,7 +82,10 @@ namespace OpenRA.Mods.Common.Activities
// If all valid weapons have depleted their ammo and Rearmable trait exists, return to RearmActor to reload and then resume the activity
if (rearmable != null && !useLastVisibleTarget && attackAircraft.Armaments.All(x => x.IsTraitPaused || !x.Weapon.IsValidAgainst(target, self.World, self)))
return ActivityUtils.SequenceActivities(self, new HeliReturnToBase(self, aircraft.Info.AbortOnResupply), this);
{
QueueChild(self, new HeliReturnToBase(self, aircraft.Info.AbortOnResupply), true);
return this;
}
var pos = self.CenterPosition;
var checkTarget = useLastVisibleTarget ? lastVisibleTarget : target;