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
This commit is contained in:
Tyler Marques 2025-06-04 16:49:33 -04:00
parent e483c82f10
commit 334950d674
No known key found for this signature in database
GPG key ID: 7672EFD79378341C
4 changed files with 15 additions and 372 deletions

View file

@ -178,65 +178,6 @@ export function updateChatWindows(phase: any, stepMessages = false) {
}
});
gameState.messagesPlaying = false;
// If instant chat is enabled during stepwise mode, immediately proceed to next phase logic
if (stepMessages && config.isInstantMode) {
// Trigger the same logic as the end of stepwise message display
if (gameState.isPlaying && !gameState.isSpeaking) {
if (gameState.gameData && gameState.gameData.phases) {
const currentPhase = gameState.gameData.phases[gameState.phaseIndex];
if (config.isDebugMode) {
console.log(`Instant chat enabled - processing end of phase ${currentPhase.name}`);
}
// Show summary first if available
if (currentPhase.summary?.trim()) {
addToNewsBanner(`(${currentPhase.name}) ${currentPhase.summary}`);
}
// Get previous phase for animations
const prevIndex = gameState.phaseIndex > 0 ? gameState.phaseIndex - 1 : null;
const previousPhase = prevIndex !== null ? gameState.gameData.phases[prevIndex] : null;
// Only schedule next phase if not already scheduled
if (!gameState.nextPhaseScheduled) {
gameState.nextPhaseScheduled = true;
// Show animations for current phase's orders
if (previousPhase) {
if (config.isDebugMode) {
console.log(`Animating orders from ${previousPhase.name} to ${currentPhase.name}`);
}
// After animations complete, advance to next phase with longer delay
gameState.playbackTimer = setTimeout(() => {
if (gameState.isPlaying) {
if (config.isDebugMode) {
console.log(`Animations complete, advancing from ${currentPhase.name}`);
}
advanceToNextPhase();
}
}, config.playbackSpeed + config.animationDuration); // Wait for both summary and animations
} else {
// For first phase, use shorter delay since there are no animations
if (config.isDebugMode) {
console.log(`First phase ${currentPhase.name} - no animations to wait for`);
}
gameState.playbackTimer = setTimeout(() => {
if (gameState.isPlaying) {
if (config.isDebugMode) {
console.log(`Advancing from first phase ${currentPhase.name}`);
}
advanceToNextPhase();
}
}, config.playbackSpeed); // Only wait for summary, no animation delay
}
}
}
}
}
} else {
// Stepwise mode: show one message at a time, animating word-by-word
gameState.messagesPlaying = true;
@ -259,64 +200,7 @@ export function updateChatWindows(phase: any, stepMessages = false) {
if (config.isDebugMode) {
console.log(`All messages displayed in ${Date.now() - messageStartTime}ms`);
}
gameState.messagesPlaying = false;
// Only proceed if we're in playback mode and not speaking
if (gameState.isPlaying && !gameState.isSpeaking) {
if (gameState.gameData && gameState.gameData.phases) {
const currentPhase = gameState.gameData.phases[gameState.phaseIndex];
if (config.isDebugMode) {
console.log(`Processing end of phase ${currentPhase.name}`);
}
// Show summary first if available
if (currentPhase.summary?.trim()) {
addToNewsBanner(`(${currentPhase.name}) ${currentPhase.summary}`);
}
// Get previous phase for animations
const prevIndex = gameState.phaseIndex > 0 ? gameState.phaseIndex - 1 : null;
const previousPhase = prevIndex !== null ? gameState.gameData.phases[prevIndex] : null;
// Only schedule next phase if not already scheduled
if (!gameState.nextPhaseScheduled) {
gameState.nextPhaseScheduled = true;
// Show animations for current phase's orders
if (previousPhase) {
if (config.isDebugMode) {
console.log(`Animating orders from ${previousPhase.name} to ${currentPhase.name}`);
}
// After animations complete, advance to next phase with longer delay
gameState.playbackTimer = setTimeout(() => {
if (gameState.isPlaying) {
if (config.isDebugMode) {
console.log(`Animations complete, advancing from ${currentPhase.name}`);
}
advanceToNextPhase();
}
}, config.effectivePlaybackSpeed + config.effectiveAnimationDuration); // Wait for both summary and animations
} else {
// For first phase, use shorter delay since there are no animations
if (config.isDebugMode) {
console.log(`First phase ${currentPhase.name} - no animations to wait for`);
}
gameState.playbackTimer = setTimeout(() => {
if (gameState.isPlaying) {
if (config.isDebugMode) {
console.log(`Advancing from first phase ${currentPhase.name}`);
}
advanceToNextPhase();
}
}, config.effectivePlaybackSpeed); // Only wait for summary, no animation delay
}
}
}
}
return;
}