Simplify ResupplyAircraft
By moving part of the take-off prevention (when TakeOffOnResupply is set to false) to Aircraft. Main reason & advantage is that dropping the 'WaitFor' child makes this activity always end when resupplies are done, which makes it more compatible with being queued as ChildActivity itself (for example by ReturnToBase).
This commit is contained in:
@@ -28,18 +28,14 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (host == null)
|
||||
return;
|
||||
|
||||
if (!aircraft.Info.TakeOffOnResupply)
|
||||
{
|
||||
ChildActivity = ActivityUtils.SequenceActivities(self, aircraft.GetResupplyActivities(host).ToArray());
|
||||
QueueChild(self, new AllowYieldingReservation(self));
|
||||
QueueChild(self, new WaitFor(() => NextActivity != null || aircraft.ReservedActor == null));
|
||||
}
|
||||
else
|
||||
{
|
||||
ChildActivity = ActivityUtils.SequenceActivities(self, aircraft.GetResupplyActivities(host).ToArray());
|
||||
QueueChild(self, new AllowYieldingReservation(self));
|
||||
var resupplyActivities = aircraft.GetResupplyActivities(host).ToArray();
|
||||
if (resupplyActivities.Any())
|
||||
QueueChild(self, ActivityUtils.SequenceActivities(self, resupplyActivities));
|
||||
|
||||
QueueChild(self, new AllowYieldingReservation(self));
|
||||
|
||||
if (aircraft.Info.TakeOffOnResupply)
|
||||
QueueChild(self, new TakeOff(self, (a, b, c) => NextActivity == null && b.NextActivity == null));
|
||||
}
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
|
||||
Reference in New Issue
Block a user