From e2f81c32dc04faca24c27538cb705905039a890e Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Fri, 10 Jan 2020 08:49:43 -0600 Subject: [PATCH] Clean up `TTS` initialization. --- TTS.gd | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/TTS.gd b/TTS.gd index 0716a07..ba8a8d0 100644 --- a/TTS.gd +++ b/TTS.gd @@ -6,15 +6,13 @@ var TTS var tts = null func _ready(): - if not TTS: + if OS.has_feature("JavaScript"): return - if not OS.has_feature('JavaScript') and not Engine.has_singleton("AndroidTTS"): - TTS = preload("godot-tts.gdns") - if OS.has_feature('JavaScript'): - pass elif Engine.has_singleton("AndroidTTS"): tts = Engine.get_singleton("AndroidTTS") - elif TTS.can_instance() or Engine.editor_hint: + else: + TTS = preload("godot-tts.gdns") + if TTS and (TTS.can_instance() or Engine.editor_hint): tts = TTS.new() else: print_debug("TTS not available!")