From 77220e6e19d367227b4e69f2994ed90e13f33be3 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 4 Jan 2024 23:03:37 -0500 Subject: Randomization progress is displayed now --- randomizer/randomizer.gd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'randomizer/randomizer.gd') diff --git a/randomizer/randomizer.gd b/randomizer/randomizer.gd index ff558a3..0738cb6 100644 --- a/randomizer/randomizer.gd +++ b/randomizer/randomizer.gd @@ -5,12 +5,18 @@ const my_version = "0.1.0" var SCRIPT_generator var generator +var thread = Thread.new() signal finished_randomizing signal randomizer_status func start(gen_seed = ""): + thread.start(self, "_thread_func", gen_seed) + yield(self, "finished_randomizing") + + +func _thread_func(gen_seed): generator = SCRIPT_generator.new($GeneratedPuzzles) generator.connect("generator_status", self, "statusUpdate") generator.generate(gen_seed) @@ -19,7 +25,7 @@ func start(gen_seed = ""): func statusUpdate(text): - emit_signal("randomizer_status", text) + call_deferred("emit_signal", "randomizer_status", text) func getSaveFileName(): -- cgit 1.4.1