From 4a06c66dbd4df4990cae610cb17c746b923b192c Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sun, 14 Apr 2019 22:45:49 +0200 Subject: [PATCH] Fix resupply anim not always finishing properly --- OpenRA.Mods.Common/Activities/Resupply.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Activities/Resupply.cs b/OpenRA.Mods.Common/Activities/Resupply.cs index d50bbffe86..0c66569885 100644 --- a/OpenRA.Mods.Common/Activities/Resupply.cs +++ b/OpenRA.Mods.Common/Activities/Resupply.cs @@ -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);