From c6429124fb6ce9492d624390db60dc868f7dc7fd Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 17 Jul 2020 20:54:49 +0200 Subject: [PATCH] Update the WorldGenerator module to get the instance() helpers. --- HEADS | 2 +- game/modules/dungeon/MainDungeon.gd | 16 ++++++++++++++++ .../test_planet/planets/dung_simple_planet.gd | 19 ++++--------------- .../test_planet/planets/simple_planet.gd | 18 +----------------- 4 files changed, 22 insertions(+), 33 deletions(-) create mode 100644 game/modules/dungeon/MainDungeon.gd diff --git a/HEADS b/HEADS index acea5d08..588f86dc 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": {"3.2": "07b24de868457c0a190c88771e99ff09e5451c3b", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "9a4f9f9809cb4da6d0196a9b37ea480e3cd0c400"}, "entity_spell_system": {"master": "af1bd74fbf38d0ac42d3cf203feb3c7212d01849"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "dee38b1588ef3224cf8022eaf227e1dcaead6277"}, "texture_packer": {"master": "2993ed34f34cfa6a5e61b7913380231e9c55eda6"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "85417ebee9198be3cd7cc643e0e0e934db64a620"}, "procedural_animations": {"master": "9226d21781ea05828570e592874aa319df0dc53d"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "544654f49b13af2d25ac14152c8a5014474e6333"}, "mesh_utils": {"master": "4f69ec67b861ce4475cfd17946dfaa586c888d94"}, "broken_seals_module": {"master": "0e5c54a70f8e90f95cbf11419b959a5f67562d48"}, "thread_pool": {"master": "93320fe864128d706bcc47fc7ed0731e6e9bcf69"}} \ No newline at end of file +{"engine": {"3.2": "07b24de868457c0a190c88771e99ff09e5451c3b", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "b70154cbddde9178e1d159a7acb7f738f7c8f487"}, "entity_spell_system": {"master": "af1bd74fbf38d0ac42d3cf203feb3c7212d01849"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "dee38b1588ef3224cf8022eaf227e1dcaead6277"}, "texture_packer": {"master": "2993ed34f34cfa6a5e61b7913380231e9c55eda6"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "85417ebee9198be3cd7cc643e0e0e934db64a620"}, "procedural_animations": {"master": "9226d21781ea05828570e592874aa319df0dc53d"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "544654f49b13af2d25ac14152c8a5014474e6333"}, "mesh_utils": {"master": "4f69ec67b861ce4475cfd17946dfaa586c888d94"}, "broken_seals_module": {"master": "0e5c54a70f8e90f95cbf11419b959a5f67562d48"}, "thread_pool": {"master": "93320fe864128d706bcc47fc7ed0731e6e9bcf69"}} \ No newline at end of file diff --git a/game/modules/dungeon/MainDungeon.gd b/game/modules/dungeon/MainDungeon.gd new file mode 100644 index 00000000..6645bac9 --- /dev/null +++ b/game/modules/dungeon/MainDungeon.gd @@ -0,0 +1,16 @@ +extends Dungeon + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/game/modules/planets/test_planet/planets/dung_simple_planet.gd b/game/modules/planets/test_planet/planets/dung_simple_planet.gd index 627682ac..0c46c41d 100644 --- a/game/modules/planets/test_planet/planets/dung_simple_planet.gd +++ b/game/modules/planets/test_planet/planets/dung_simple_planet.gd @@ -29,16 +29,10 @@ func _setup(): return var bdata : BiomeData = data.get_biome_data(0) - - var b : Biome - - if bdata.biome != null: - b = bdata.biome.duplicate() - else: - b = Biome.new() + var b : Biome = bdata.instance() + b.current_seed = current_seed - b.data = bdata b.setup() add_biome(b) @@ -47,17 +41,12 @@ func _setup(): var dd : DungeonData = bdata.get_dungeon_data(0) - var dung : Dungeon - if dd.dungeon != null: - dung = dd.dungeon.duplicate() - else: - dung = Dungeon.new() - + var dung : Dungeon = dd.instance() + dung.posx = 0 dung.posy = -4 dung.posz = 0 dung.current_seed = current_seed - dung.data = dd dung.setup() add_dungeon(dung) diff --git a/game/modules/planets/test_planet/planets/simple_planet.gd b/game/modules/planets/test_planet/planets/simple_planet.gd index 6c10370a..1b706113 100644 --- a/game/modules/planets/test_planet/planets/simple_planet.gd +++ b/game/modules/planets/test_planet/planets/simple_planet.gd @@ -30,25 +30,9 @@ func _setup(): var bdata : BiomeData = data.get_biome_data(0) - var b : Biome - - if bdata.target_script != null: - b = bdata.target_script.new() - - if b == null: - print("biome is null. wrong type? " + bdata.resource_path) - return - elif bdata.target_class_name != "": - if not ClassDB.class_exists(bdata.target_class_name): - print("class doesnt exists" + bdata.resource_path) - return - - b = ClassDB.instance(bdata.target_class_name) - else: - b = Biome.new() + var b : Biome = bdata.instance() b.current_seed = current_seed - b.data = bdata b.setup() add_biome(b)