Clean up TTS initialization.

This commit is contained in:
Nolan Darilek 2020-01-10 08:49:43 -06:00
parent 934a40e273
commit e2f81c32dc

10
TTS.gd
View File

@ -6,15 +6,13 @@ var TTS
var tts = null var tts = null
func _ready(): func _ready():
if not TTS: if OS.has_feature("JavaScript"):
return 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"): elif Engine.has_singleton("AndroidTTS"):
tts = Engine.get_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() tts = TTS.new()
else: else:
print_debug("TTS not available!") print_debug("TTS not available!")