Simplify Activity class
After the removal of the CompositeActivity class, all the supporting code that made it work can be removed as well.
This commit is contained in:
committed by
Paul Chote
parent
19977bb7da
commit
b4fd7331b2
@@ -32,13 +32,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
ChildActivity = ActivityUtils.SequenceActivities(self, aircraft.GetResupplyActivities(host).ToArray());
|
||||
QueueChild(self, new AllowYieldingReservation(self));
|
||||
QueueChild(self, new WaitFor(() => NextInQueue != null || aircraft.ReservedActor == null));
|
||||
QueueChild(self, new WaitFor(() => NextActivity != null || aircraft.ReservedActor == null));
|
||||
}
|
||||
else
|
||||
{
|
||||
ChildActivity = ActivityUtils.SequenceActivities(self, aircraft.GetResupplyActivities(host).ToArray());
|
||||
QueueChild(self, new AllowYieldingReservation(self));
|
||||
QueueChild(self, new TakeOff(self, (a, b, c) => NextInQueue == null && b.NextInQueue == null));
|
||||
QueueChild(self, new TakeOff(self, (a, b, c) => NextActivity == null && b.NextActivity == null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (NextInQueue != null)
|
||||
return NextInQueue;
|
||||
if (NextActivity != null)
|
||||
return NextActivity;
|
||||
|
||||
// Find the nearest best refinery if not explicitly ordered to a specific refinery:
|
||||
if (harv.OwnerLinkedProc == null || !harv.OwnerLinkedProc.IsInWorld)
|
||||
|
||||
@@ -80,8 +80,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
var randFrames = self.World.SharedRandom.Next(100, 175);
|
||||
|
||||
// Avoid creating an activity cycle
|
||||
var next = NextInQueue;
|
||||
NextInQueue = null;
|
||||
var next = NextActivity;
|
||||
NextActivity = null;
|
||||
return ActivityUtils.SequenceActivities(self, next, new Wait(randFrames), this);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user