Checkpoint current interactive fiction state
This commit is contained in:
@@ -9,7 +9,7 @@ export class DebugUtilsModule extends BaseModule {
|
||||
super('debug-utils', 'Debug Utilities');
|
||||
|
||||
// Declare dependencies explicitly
|
||||
this.dependencies = ['text-buffer', 'socket-client', 'tts-player', 'ui-controller', 'game-loop'];
|
||||
this.dependencies = ['text-buffer', 'socket-client', 'tts-factory', 'ui-controller', 'game-loop'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,31 +83,27 @@ export class DebugUtilsModule extends BaseModule {
|
||||
*/
|
||||
testTTS(text = "This is a test of the text to speech system.") {
|
||||
console.log("Debug: Testing TTS with:", text);
|
||||
|
||||
// Get the TTS module properly through dependency system
|
||||
const ttsPlayer = this.getModule('tts-player');
|
||||
if (!ttsPlayer) {
|
||||
console.error("Debug: TTS module not found");
|
||||
|
||||
// Get the TTS factory properly through dependency system
|
||||
const ttsFactory = this.getModule('tts-factory');
|
||||
if (!ttsFactory) {
|
||||
console.error("Debug: TTS factory not found");
|
||||
return false;
|
||||
}
|
||||
|
||||
const wasEnabled = ttsPlayer.isEnabled();
|
||||
|
||||
// Enable TTS temporarily if it was disabled
|
||||
if (!wasEnabled && ttsPlayer.toggle) {
|
||||
ttsPlayer.toggle();
|
||||
|
||||
const activeHandler = ttsFactory.getActiveHandler();
|
||||
if (!activeHandler) {
|
||||
console.error("Debug: No active TTS handler");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Speak the text
|
||||
ttsPlayer.speak(text, (result) => {
|
||||
ttsFactory.speak(text).then((result) => {
|
||||
console.log("Debug: TTS completed with result:", result);
|
||||
|
||||
// Restore previous enabled state
|
||||
if (!wasEnabled && ttsPlayer.toggle) {
|
||||
ttsPlayer.toggle();
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error("Debug: TTS error:", error);
|
||||
});
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -123,10 +119,10 @@ export class DebugUtilsModule extends BaseModule {
|
||||
const socketClient = this.getModule('socket-client');
|
||||
const gameLoop = this.getModule('game-loop');
|
||||
const textBuffer = this.getModule('text-buffer');
|
||||
const ttsHandler = this.getModule('tts-player');
|
||||
|
||||
const ttsFactory = this.getModule('tts-factory');
|
||||
|
||||
// Check if all modules are available
|
||||
if (!uiController || !socketClient || !gameLoop || !textBuffer || !ttsHandler) {
|
||||
if (!uiController || !socketClient || !gameLoop || !textBuffer || !ttsFactory) {
|
||||
console.error("Debug: One or more required modules not found");
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user