Skip to content

Commit e232d4a

Browse files
committed
Another fix for the turns getting stuck
1 parent ad3af94 commit e232d4a

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

ai_animation/src/components/rotatingDisplay.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ function rotateToNextDisplay(): void {
7979

8080
// Determine next display type
8181
switch (currentDisplayType) {
82-
case DisplayType.SC_HISTORY_CHART:
83-
currentDisplayType = DisplayType.RELATIONSHIP_HISTORY_CHART;
84-
break;
82+
//FIXME: This should be turned back on. It's not rotating right now for some reason, and we need to fix that.
83+
//
84+
// case DisplayType.SC_HISTORY_CHART:
85+
// currentDisplayType = DisplayType.RELATIONSHIP_HISTORY_CHART;
86+
// break;
8587
case DisplayType.RELATIONSHIP_HISTORY_CHART:
8688
currentDisplayType = DisplayType.SC_HISTORY_CHART;
8789
break;

ai_animation/src/main.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,7 @@ function animate(currentTime: number = 0) {
191191
console.log(`Scheduling next phase in ${config.effectivePlaybackSpeed}ms`);
192192
gameState.nextPhaseScheduled = true;
193193
gameState.playbackTimer = setTimeout(() => {
194-
try {
195-
advanceToNextPhase()
196-
} catch {
197-
// FIXME: This is a dumb patch for us not being able to find the unit we expect to find.
198-
// 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
199-
nextPhase()
200-
gameState.nextPhaseScheduled;
201-
}
194+
advanceToNextPhase()
202195
}, config.effectivePlaybackSpeed);
203196
}
204197
// Update any pulsing or wave animations on supply centers or units

ai_animation/src/phase.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ export function previousPhase() {
169169
export function displayPhase(skipMessages = false) {
170170
let index = gameState.phaseIndex
171171
if (index >= gameState.gameData.phases.length) {
172+
// FIXME: Calling this here as well as in nextPhase is unneeded
173+
172174
displayFinalPhase()
173175
logger.log("Displayed final phase.")
174176
return;
@@ -221,10 +223,17 @@ export function displayPhase(skipMessages = false) {
221223
// Only animate if not the first phase and animations are requested
222224
if (!isFirstPhase && !skipMessages) {
223225
if (previousPhase) {
224-
// Don't create animations immediately if messages are still playing
225-
// The main loop will handle this when messages finish
226-
if (!gameState.messagesPlaying) {
227-
createAnimationsForNextPhase();
226+
try {
227+
// Don't create animations immediately if messages are still playing
228+
// The main loop will handle this when messages finish
229+
if (!gameState.messagesPlaying) {
230+
createAnimationsForNextPhase();
231+
}
232+
} catch (error) {
233+
console.warn(`Caught below error when attempting to create animations. Moving on without them.`)
234+
console.error(error)
235+
initUnits(gameState.phaseIndex)
236+
228237
}
229238
}
230239
} else {
@@ -282,7 +291,7 @@ export function advanceToNextPhase() {
282291
// In streaming mode, add extra delay before speech to ensure phase is fully displayed
283292
const isStreamingMode = import.meta.env.VITE_STREAMING_MODE === 'True' || import.meta.env.VITE_STREAMING_MODE === 'true';
284293
const speechDelay = isStreamingMode ? 2000 : 0; // 2 second delay in streaming mode
285-
294+
286295
// First show summary if available
287296
if (currentPhase.summary && currentPhase.summary.trim() !== '') {
288297
// Delay speech in streaming mode

0 commit comments

Comments
 (0)