Skip to content

Commit 334950d

Browse files
committed
FIX: Some phase logic was mucked in chatwindows
This created some very weird behaviour where it got hung up on certain phases. Removed that logic, as well as extraneous file relationshipPopup.ts
1 parent e483c82 commit 334950d

File tree

4 files changed

+15
-372
lines changed

4 files changed

+15
-372
lines changed

ai_animation/src/domElements/chatWindows.ts

Lines changed: 0 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -178,65 +178,6 @@ export function updateChatWindows(phase: any, stepMessages = false) {
178178
}
179179
});
180180
gameState.messagesPlaying = false;
181-
182-
// If instant chat is enabled during stepwise mode, immediately proceed to next phase logic
183-
if (stepMessages && config.isInstantMode) {
184-
// Trigger the same logic as the end of stepwise message display
185-
if (gameState.isPlaying && !gameState.isSpeaking) {
186-
if (gameState.gameData && gameState.gameData.phases) {
187-
const currentPhase = gameState.gameData.phases[gameState.phaseIndex];
188-
189-
if (config.isDebugMode) {
190-
console.log(`Instant chat enabled - processing end of phase ${currentPhase.name}`);
191-
}
192-
193-
// Show summary first if available
194-
if (currentPhase.summary?.trim()) {
195-
addToNewsBanner(`(${currentPhase.name}) ${currentPhase.summary}`);
196-
}
197-
198-
// Get previous phase for animations
199-
const prevIndex = gameState.phaseIndex > 0 ? gameState.phaseIndex - 1 : null;
200-
const previousPhase = prevIndex !== null ? gameState.gameData.phases[prevIndex] : null;
201-
202-
// Only schedule next phase if not already scheduled
203-
if (!gameState.nextPhaseScheduled) {
204-
gameState.nextPhaseScheduled = true;
205-
206-
// Show animations for current phase's orders
207-
if (previousPhase) {
208-
if (config.isDebugMode) {
209-
console.log(`Animating orders from ${previousPhase.name} to ${currentPhase.name}`);
210-
}
211-
212-
// After animations complete, advance to next phase with longer delay
213-
gameState.playbackTimer = setTimeout(() => {
214-
if (gameState.isPlaying) {
215-
if (config.isDebugMode) {
216-
console.log(`Animations complete, advancing from ${currentPhase.name}`);
217-
}
218-
advanceToNextPhase();
219-
}
220-
}, config.playbackSpeed + config.animationDuration); // Wait for both summary and animations
221-
} else {
222-
// For first phase, use shorter delay since there are no animations
223-
if (config.isDebugMode) {
224-
console.log(`First phase ${currentPhase.name} - no animations to wait for`);
225-
}
226-
227-
gameState.playbackTimer = setTimeout(() => {
228-
if (gameState.isPlaying) {
229-
if (config.isDebugMode) {
230-
console.log(`Advancing from first phase ${currentPhase.name}`);
231-
}
232-
advanceToNextPhase();
233-
}
234-
}, config.playbackSpeed); // Only wait for summary, no animation delay
235-
}
236-
}
237-
}
238-
}
239-
}
240181
} else {
241182
// Stepwise mode: show one message at a time, animating word-by-word
242183
gameState.messagesPlaying = true;
@@ -259,64 +200,7 @@ export function updateChatWindows(phase: any, stepMessages = false) {
259200
if (config.isDebugMode) {
260201
console.log(`All messages displayed in ${Date.now() - messageStartTime}ms`);
261202
}
262-
263203
gameState.messagesPlaying = false;
264-
265-
// Only proceed if we're in playback mode and not speaking
266-
if (gameState.isPlaying && !gameState.isSpeaking) {
267-
if (gameState.gameData && gameState.gameData.phases) {
268-
const currentPhase = gameState.gameData.phases[gameState.phaseIndex];
269-
270-
if (config.isDebugMode) {
271-
console.log(`Processing end of phase ${currentPhase.name}`);
272-
}
273-
274-
// Show summary first if available
275-
if (currentPhase.summary?.trim()) {
276-
addToNewsBanner(`(${currentPhase.name}) ${currentPhase.summary}`);
277-
}
278-
279-
// Get previous phase for animations
280-
const prevIndex = gameState.phaseIndex > 0 ? gameState.phaseIndex - 1 : null;
281-
const previousPhase = prevIndex !== null ? gameState.gameData.phases[prevIndex] : null;
282-
283-
// Only schedule next phase if not already scheduled
284-
if (!gameState.nextPhaseScheduled) {
285-
gameState.nextPhaseScheduled = true;
286-
287-
// Show animations for current phase's orders
288-
if (previousPhase) {
289-
if (config.isDebugMode) {
290-
console.log(`Animating orders from ${previousPhase.name} to ${currentPhase.name}`);
291-
}
292-
293-
// After animations complete, advance to next phase with longer delay
294-
gameState.playbackTimer = setTimeout(() => {
295-
if (gameState.isPlaying) {
296-
if (config.isDebugMode) {
297-
console.log(`Animations complete, advancing from ${currentPhase.name}`);
298-
}
299-
advanceToNextPhase();
300-
}
301-
}, config.effectivePlaybackSpeed + config.effectiveAnimationDuration); // Wait for both summary and animations
302-
} else {
303-
// For first phase, use shorter delay since there are no animations
304-
if (config.isDebugMode) {
305-
console.log(`First phase ${currentPhase.name} - no animations to wait for`);
306-
}
307-
308-
gameState.playbackTimer = setTimeout(() => {
309-
if (gameState.isPlaying) {
310-
if (config.isDebugMode) {
311-
console.log(`Advancing from first phase ${currentPhase.name}`);
312-
}
313-
advanceToNextPhase();
314-
}
315-
}, config.effectivePlaybackSpeed); // Only wait for summary, no animation delay
316-
}
317-
}
318-
}
319-
}
320204
return;
321205
}
322206

ai_animation/src/domElements/relationshipPopup.ts

Lines changed: 0 additions & 244 deletions
This file was deleted.

0 commit comments

Comments
 (0)