Fix resupply anim not always finishing properly

This commit is contained in:
reaperrr
2019-04-14 22:45:49 +02:00
committed by Paul Chote
parent 83934074a4
commit 4a06c66dbd

View File

@@ -75,14 +75,15 @@ namespace OpenRA.Mods.Common.Activities
public override Activity Tick(Actor self)
{
if (IsCanceling)
return NextActivity;
if (IsCanceling || host.Type == TargetType.Invalid
|| (closeEnough.LengthSquared > 0 && !host.IsInRange(self.CenterPosition, closeEnough)))
{
// This is necessary to ensure host resupply actions (like animations) finish properly
foreach (var notifyResupply in notifyResupplies)
notifyResupply.ResupplyTick(host.Actor, self, ResupplyType.None);
if (host.Type == TargetType.Invalid)
return NextActivity;
if (closeEnough.LengthSquared > 0 && !host.IsInRange(self.CenterPosition, closeEnough))
return NextActivity;
}
if (activeResupplyTypes.HasFlag(ResupplyType.Repair))
RepairTick(self);