From 5f0732b39bc643759f4bfd0962074e5de42b5d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Wed, 4 Apr 2018 23:15:14 +0200 Subject: [PATCH] Fixed move animation being done as background when coming from an action --- src/ui/battle/ArenaShip.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/ui/battle/ArenaShip.ts b/src/ui/battle/ArenaShip.ts index a0bcd36..2c1dcce 100644 --- a/src/ui/battle/ArenaShip.ts +++ b/src/ui/battle/ArenaShip.ts @@ -254,15 +254,18 @@ module TK.SpaceTac.UI { return {}; } } else if (diff instanceof ShipMoveDiff) { - return { - background: async (animate: boolean, timer: Timer) => { - this.moveTo(diff.start.x, diff.start.y, diff.start.angle, false); - let duration = this.moveTo(diff.end.x, diff.end.y, diff.end.angle, animate, !!diff.engine); - if (duration && animate) { - await timer.sleep(duration); - } + let func = async (animate: boolean, timer: Timer) => { + this.moveTo(diff.start.x, diff.start.y, diff.start.angle, false); + let duration = this.moveTo(diff.end.x, diff.end.y, diff.end.angle, animate, !!diff.engine); + if (duration && animate) { + await timer.sleep(duration); } }; + if (diff.engine) { + return { foreground: func }; + } else { + return { background: func }; + } } else if (diff instanceof VigilanceAppliedDiff) { let action = this.ship.actions.getById(diff.action); return {