From b862b7361c0cdba68c5d566af75eeee0b5781558 Mon Sep 17 00:00:00 2001 From: Valentin Stark Date: Mon, 22 Aug 2022 15:44:45 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9placement=20de=20la=20g=C3=A9n=C3=A9rati?= =?UTF-8?q?on=20du=20monde=20dans=20un=20thread?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/world_generation/WorldGeneration.gd | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/utils/world_generation/WorldGeneration.gd b/utils/world_generation/WorldGeneration.gd index 041ff58..a9b8826 100644 --- a/utils/world_generation/WorldGeneration.gd +++ b/utils/world_generation/WorldGeneration.gd @@ -14,7 +14,16 @@ export(int) var river_proba = 200 var rng = RandomNumberGenerator.new() var noise = OpenSimplexNoise.new() +var thread + func _ready(): + thread = Thread.new() + thread.start(self, "_generate_world") + +func _exit_tree(): + thread.wait_to_finish() + +func _generate_world(): rng.randomize() noise.seed = rng.randi() noise.octaves = octaves @@ -37,6 +46,7 @@ func _ready(): Global.print_debug("Pas de construction ..., pas de palais ...") Global.print_debug("Pas de palais ..., pas de palais.") + func init_data(): # for point in Global.terrain.get_points(): # point.set_elevation(point_find_elevation(point.point2d()))