Skip to content

Commit 4e3d6ba

Browse files
committed
FIX: Catching bad next phase
Sometimes there is an animation missing, or we can't find the unit we expect to find for the animation, and it throws an error. This was cancelling the move forward. "Fixing" with a catch for now.
1 parent d3d8b22 commit 4e3d6ba

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ai_animation/src/main.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,14 @@ function animate() {
149149
console.log(`Scheduling next phase in ${config.effectivePlaybackSpeed}ms`);
150150
gameState.nextPhaseScheduled = true;
151151
gameState.playbackTimer = setTimeout(() => {
152-
advanceToNextPhase();
152+
try {
153+
advanceToNextPhase()
154+
} catch {
155+
// FIXME: This is a dumb patch for us not being able to find the unit we expect to find.
156+
// We should instead bee figuring out why units aren't where we expect them to be when the engine has said that is a valid move
157+
nextPhase()
158+
gameState.nextPhaseScheduled;
159+
}
153160
}, config.effectivePlaybackSpeed);
154161
}
155162
// Update any pulsing or wave animations on supply centers or units

0 commit comments

Comments
 (0)