summary refs log tree commit diff stats
path: root/randomizer/randomizer.gd
blob: 0738cb61958171a4bebd69e4aa126d321c5a2a3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
extends Node

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)

	emit_signal("finished_randomizing")


func statusUpdate(text):
	call_deferred("emit_signal", "randomizer_status", text)


func getSaveFileName():
	return "zzRN_%d" % generator.gen_seed