blob: 2d2620860f0c4a724dc436aeef071d7801d3dcf5 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
extends Node
const my_version = "0.1.0"
var SCRIPT_generator
var SCRIPT_steady
var generator
var steady
var sunwarps
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)
var rng = RandomNumberGenerator.new()
rng.seed = generator.gen_seed
steady = SCRIPT_steady.new()
steady.generate(rng)
var iota = range(1, 13)
sunwarps = []
while not iota.empty():
var i = rng.randi_range(0, iota.size() - 1)
sunwarps.append(iota[i])
iota.remove(i)
emit_signal("finished_randomizing")
func statusUpdate(text):
call_deferred("emit_signal", "randomizer_status", text)
func getSaveFileName():
return "zzRN_%d" % generator.gen_seed
|