Fix undock anim playing even if docking was cancelled

...before dock anim could run.

The undock animation would play even if the dock anim
hadn't run (meaning the sequence cancelled before the docking
completed, for example due to refinery death).
This commit is contained in:
reaperrr
2020-10-18 13:46:08 +02:00
committed by abcdefg30
parent 87929b3d91
commit 996029ee38
2 changed files with 15 additions and 4 deletions

View File

@@ -45,10 +45,12 @@ namespace OpenRA.Mods.Cnc.Activities
public override void OnStateUndock(Actor self)
{
dockingState = DockingState.Wait;
if (spriteOverlay != null && !spriteOverlay.Visible)
// If body.Docked wasn't set, we didn't actually dock and have to skip the undock overlay
if (!body.Docked)
dockingState = DockingState.Complete;
else if (spriteOverlay != null && !spriteOverlay.Visible)
{
dockingState = DockingState.Wait;
spriteOverlay.Visible = true;
spriteOverlay.WithOffset.Animation.PlayBackwardsThen(spriteOverlay.Info.Sequence, () =>
{