Replace pseudo-childactivities in WaitForTransport.
This commit is contained in:
@@ -19,34 +19,25 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
readonly ICallForTransport transportable;
|
readonly ICallForTransport transportable;
|
||||||
|
|
||||||
Activity inner;
|
|
||||||
|
|
||||||
public WaitForTransport(Actor self, Activity innerActivity)
|
public WaitForTransport(Actor self, Activity innerActivity)
|
||||||
{
|
{
|
||||||
transportable = self.TraitOrDefault<ICallForTransport>();
|
transportable = self.TraitOrDefault<ICallForTransport>();
|
||||||
inner = innerActivity;
|
QueueChild(self, innerActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (inner == null)
|
if (ChildActivity != null)
|
||||||
{
|
{
|
||||||
if (transportable != null)
|
ChildActivity = ActivityUtils.RunActivity(self, ChildActivity);
|
||||||
transportable.MovementCancelled(self);
|
if (ChildActivity != null)
|
||||||
|
return this;
|
||||||
return NextActivity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inner = ActivityUtils.RunActivity(self, inner);
|
if (transportable != null)
|
||||||
return this;
|
transportable.MovementCancelled(self);
|
||||||
}
|
|
||||||
|
|
||||||
public override void Cancel(Actor self, bool keepQueue = false)
|
return NextActivity;
|
||||||
{
|
|
||||||
if (!IsCanceling && inner != null)
|
|
||||||
inner.Cancel(self);
|
|
||||||
|
|
||||||
base.Cancel(self, keepQueue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user