diff --git a/HEADS b/HEADS index c192b3d0..4e7ff2fa 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": {"3.2": "c79ec3951b44df4d794c3076e10c67a35b9d662d", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "59dde526b9d10079ca61b50ee2b619db31bfb32d"}, "entity_spell_system": {"master": "af1bd74fbf38d0ac42d3cf203feb3c7212d01849"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "e9dc7d18dd65b699781c383305fb45efbfb9d53c"}, "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": "af35d0d3c83161848fad952f24d42592b1a9b932", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "eed7f40e51fb8aceb032a909adb08a2f9366bf13"}, "entity_spell_system": {"master": "af1bd74fbf38d0ac42d3cf203feb3c7212d01849"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "e9dc7d18dd65b699781c383305fb45efbfb9d53c"}, "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": "8c4b32d3932ccb043b8f6c92c1277547750fe391"}, "thread_pool": {"master": "93320fe864128d706bcc47fc7ed0731e6e9bcf69"}} \ No newline at end of file diff --git a/game/menu/Menu.tscn b/game/menu/Menu.tscn index d811656c..d75c5ae9 100644 --- a/game/menu/Menu.tscn +++ b/game/menu/Menu.tscn @@ -20,7 +20,7 @@ [ext_resource path="res://scripts/world_generators/MainPlanetGenerator.gd" type="Script" id=18] [ext_resource path="res://scripts/settings/DirectionalLightSettings.gd" type="Script" id=19] [ext_resource path="res://ui/about/About.tscn" type="PackedScene" id=20] -[ext_resource path="res://modules/planets/test_planet/SimplePlanetData.tres" type="PlanetData" id=21] +[ext_resource path="res://modules/planets/test_planet/SimplePlanetData.tres" type="Planet" id=21] [sub_resource type="VoxelmanLevelGenerator" id=1] script = ExtResource( 18 ) diff --git a/game/modules/planets/test_planet/DungeonPlanetData.tres b/game/modules/planets/test_planet/DungeonPlanetData.tres index 247cc090..d18abc07 100644 --- a/game/modules/planets/test_planet/DungeonPlanetData.tres +++ b/game/modules/planets/test_planet/DungeonPlanetData.tres @@ -1,9 +1,9 @@ -[gd_resource type="PlanetData" load_steps=3 format=2] +[gd_resource type="Planet" load_steps=3 format=2] -[ext_resource path="res://modules/planets/test_planet/planets/simple_planet.tres" type="Planet" id=1] -[ext_resource path="res://modules/planets/test_planet/biomes/2_tdungb.tres" type="BiomeData" id=2] +[ext_resource path="res://modules/planets/test_planet/planets/dung_simple_planet.gd" type="Script" id=1] +[ext_resource path="res://modules/planets/test_planet/biomes/2_tdungb.tres" type="Biome" id=2] [resource] id = 1 -planet = ExtResource( 1 ) -biome_datas = [ ExtResource( 2 ) ] +biomes = [ ExtResource( 2 ) ] +script = ExtResource( 1 ) diff --git a/game/modules/planets/test_planet/SimplePlanetData.tres b/game/modules/planets/test_planet/SimplePlanetData.tres index aee3118f..af963de2 100644 --- a/game/modules/planets/test_planet/SimplePlanetData.tres +++ b/game/modules/planets/test_planet/SimplePlanetData.tres @@ -1,9 +1,9 @@ -[gd_resource type="PlanetData" load_steps=3 format=2] +[gd_resource type="Planet" load_steps=3 format=2] -[ext_resource path="res://modules/planets/test_planet/planets/simple_planet.tres" type="Planet" id=1] -[ext_resource path="res://modules/planets/test_planet/biomes/1_test.tres" type="BiomeData" id=2] +[ext_resource path="res://modules/planets/test_planet/planets/dung_simple_planet.gd" type="Script" id=1] +[ext_resource path="res://modules/planets/test_planet/biomes/1_test.tres" type="Biome" id=2] [resource] id = 1 -planet = ExtResource( 1 ) -biome_datas = [ ExtResource( 2 ) ] +biomes = [ ExtResource( 2 ) ] +script = ExtResource( 1 ) diff --git a/game/modules/planets/test_planet/biomes/1_test.tres b/game/modules/planets/test_planet/biomes/1_test.tres index 9b20b1cc..b8bff07f 100644 --- a/game/modules/planets/test_planet/biomes/1_test.tres +++ b/game/modules/planets/test_planet/biomes/1_test.tres @@ -1,7 +1,6 @@ -[gd_resource type="BiomeData" load_steps=2 format=2] +[gd_resource type="Biome" load_steps=2 format=2] -[ext_resource path="res://modules/planets/test_planet/biomes/biome1.tres" type="BiomeBase" id=1] +[ext_resource path="res://modules/planets/test_planet/biomes/simple_biome.gd" type="Script" id=1] [resource] -biome = ExtResource( 1 ) -voxel_surfaces = [ null, null, null, null ] +script = ExtResource( 1 ) diff --git a/game/modules/planets/test_planet/biomes/2_tdungb.tres b/game/modules/planets/test_planet/biomes/2_tdungb.tres index 3ac74a66..38522dc4 100644 --- a/game/modules/planets/test_planet/biomes/2_tdungb.tres +++ b/game/modules/planets/test_planet/biomes/2_tdungb.tres @@ -1,8 +1,8 @@ -[gd_resource type="BiomeData" load_steps=3 format=2] +[gd_resource type="Biome" load_steps=3 format=2] -[ext_resource path="res://modules/planets/test_planet/dungeons/1_test.tres" type="DungeonData" id=1] -[ext_resource path="res://modules/planets/test_planet/biomes/biome1.tres" type="BiomeBase" id=2] +[ext_resource path="res://modules/planets/test_planet/biomes/simple_biome.gd" type="Script" id=1] +[ext_resource path="res://modules/planets/test_planet/dungeons/dungeon.tres" type="Dungeon" id=2] [resource] -biome = ExtResource( 2 ) -dungeon_datas = [ ExtResource( 1 ) ] +dungeons = [ ExtResource( 2 ) ] +script = ExtResource( 1 ) diff --git a/game/modules/planets/test_planet/biomes/biome1.tres b/game/modules/planets/test_planet/biomes/biome1.tres deleted file mode 100644 index 05787820..00000000 --- a/game/modules/planets/test_planet/biomes/biome1.tres +++ /dev/null @@ -1,6 +0,0 @@ -[gd_resource type="BiomeBase" load_steps=2 format=2] - -[ext_resource path="res://modules/planets/test_planet/biomes/simple_biome.gd" type="Script" id=1] - -[resource] -script = ExtResource( 1 ) diff --git a/game/modules/planets/test_planet/biomes/simple_biome.gd b/game/modules/planets/test_planet/biomes/simple_biome.gd index 86ebaa74..d63e520f 100644 --- a/game/modules/planets/test_planet/biomes/simple_biome.gd +++ b/game/modules/planets/test_planet/biomes/simple_biome.gd @@ -1,4 +1,4 @@ -extends BiomeBase +extends Biome # Copyright (c) 2019-2020 Péter Magyar # @@ -20,34 +20,25 @@ extends BiomeBase # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -func _setup(): - if !data: - return - - for i in range(data.get_dungeon_data_count()): - var dd : DungeonData = data.get_dungeon_data(i) - - if !dd: - continue +var terrarin_gen : BiomeTerrarinGenerator = BiomeTerrarinGenerator.new() - var d : Dungeon = dd.instance() - d.posx = 0 - d.posz = 0 - d.posy = -20 - d.current_seed = current_seed +func _setup(): + terrarin_gen.set_current_seed(current_seed) + + for i in range(get_dungeon_count()): + var d : Dungeon = get_dungeon(i) d.setup() - add_dungeon(d) func _generate_chunk(chunk: VoxelChunk, spawn_mobs: bool) -> void: # var chunk : VoxelChunk = chunk.get_chunk() -# generate_terrarin(chunk, spawn_mobs) +# generate_terrarin(chunk, spawn_mobs)\ + + terrarin_gen.generate_simple_terrarin(chunk, spawn_mobs) for i in range(get_dungeon_count()): get_dungeon(i).generate_chunk(chunk, spawn_mobs) - generate_simple_terrarin(chunk, spawn_mobs) - if not Engine.editor_hint and chunk.position_y == 0 and spawn_mobs and randi() % 4 == 0: ESS.entity_spawner.spawn_mob(0, randi() % 3, Vector3(chunk.position_x * chunk.size_x * chunk.voxel_scale + chunk.size_x / 2,\ (chunk.position_y + 1) * chunk.size_y * chunk.voxel_scale, \ diff --git a/game/modules/planets/test_planet/dungeon_rooms/1_test.tres b/game/modules/planets/test_planet/dungeon_rooms/1_test.tres index 163862e1..e56c74d7 100644 --- a/game/modules/planets/test_planet/dungeon_rooms/1_test.tres +++ b/game/modules/planets/test_planet/dungeon_rooms/1_test.tres @@ -1,4 +1,4 @@ -[gd_resource type="DungeonRoomData" load_steps=2 format=2] +[gd_resource type="DungeonRoom" load_steps=2 format=2] [ext_resource path="res://modules/planets/test_planet/dungeon_rooms/dungeon_room.tres" type="DungeonRoom" id=1] diff --git a/game/modules/planets/test_planet/dungeon_rooms/2_test_start_room.tres b/game/modules/planets/test_planet/dungeon_rooms/2_test_start_room.tres index 163862e1..e56c74d7 100644 --- a/game/modules/planets/test_planet/dungeon_rooms/2_test_start_room.tres +++ b/game/modules/planets/test_planet/dungeon_rooms/2_test_start_room.tres @@ -1,4 +1,4 @@ -[gd_resource type="DungeonRoomData" load_steps=2 format=2] +[gd_resource type="DungeonRoom" load_steps=2 format=2] [ext_resource path="res://modules/planets/test_planet/dungeon_rooms/dungeon_room.tres" type="DungeonRoom" id=1] diff --git a/game/modules/planets/test_planet/dungeons/1_test.tres b/game/modules/planets/test_planet/dungeons/1_test.tres index 0409b721..178b32b0 100644 --- a/game/modules/planets/test_planet/dungeons/1_test.tres +++ b/game/modules/planets/test_planet/dungeons/1_test.tres @@ -1,8 +1,3 @@ -[gd_resource type="DungeonData" load_steps=3 format=2] - -[ext_resource path="res://modules/planets/test_planet/dungeons/dungeon.tres" type="Dungeon" id=1] -[ext_resource path="res://modules/planets/test_planet/dungeon_rooms/2_test_start_room.tres" type="DungeonRoomData" id=2] +[gd_resource type="Dungeon" format=2] [resource] -dungeon = ExtResource( 1 ) -dungeon_start_room_datas = [ ExtResource( 2 ) ] diff --git a/game/modules/planets/test_planet/dungeons/dungeon.gd b/game/modules/planets/test_planet/dungeons/dungeon.gd index ffe4db17..0ceb689a 100644 --- a/game/modules/planets/test_planet/dungeons/dungeon.gd +++ b/game/modules/planets/test_planet/dungeons/dungeon.gd @@ -57,6 +57,33 @@ var enemy_data : Array = [] enum NeighbourCaseCodeFlags { WallXP = 1, WallXN = 2, WallZP = 4, WallZN = 8 } enum Tile { Wall, Floor, Door, Empty } +func _instance(p_seed, p_instance): + if !p_instance: + p_instance = ._instance(p_seed, p_instance) + + p_instance.level_room_count = level_room_count + p_instance.min_room_dimension = min_room_dimension + p_instance.max_room_dimension = max_room_dimension + p_instance.enemy_count = enemy_count + + p_instance.spawn_mobs = spawn_mobs + + p_instance.dung_floor = dung_floor + p_instance.dung_ceiling = dung_ceiling + p_instance.dung_wall_xp = dung_wall_xp + p_instance.dung_wall_xn = dung_wall_xn + p_instance.dung_wall_zp = dung_wall_zp + p_instance.dung_wall_zn = dung_wall_zn + + p_instance.wall_texture = wall_texture + p_instance.floor_texture = floor_texture + p_instance.ceiling_texture = ceiling_texture + + p_instance.dung_entrance_mdr = dung_entrance_mdr + p_instance.dung_entrance_scene = dung_entrance_scene + + return p_instance + func _setup(): if sizex == 0 || sizey == 0 || sizez == 0: print("Dungeon size is 0!") @@ -67,7 +94,7 @@ func _setup(): # if data.get_dungeon_start_room_data_count() == 0: # return # -# var drd : DungeonRoomData = data.get_dungeon_start_room_data(0) +# var drd : DungeonRoom = data.get_dungeon_start_room_data(0) # # var dung : DungeonRoom = drd.instance() # @@ -80,7 +107,7 @@ func _setup(): # # add_dungeon_start_room(dung) - posy = 7 + posy = 5 build() @@ -93,8 +120,8 @@ func _setup_library(library): library.get_prop_packer().add_texture(ceiling_texture) func _generate_chunk(chunk, spawn_mobs): - var aabb : AABB = AABB(Vector3(posx, posy, posz) * chunk.get_voxel_scale(), Vector3(sizex, sizey, sizez) * chunk.get_voxel_scale()) - var chunk_aabb : AABB = AABB(chunk.get_position() * Vector3(chunk.size_x, chunk.size_y, chunk.size_z) * chunk.get_voxel_scale(), Vector3(chunk.size_x, chunk.size_y, chunk.size_z) * chunk.get_voxel_scale()) + var aabb : AABB = AABB(Vector3(posx - 1, posy - 1, posz - 1), Vector3(sizex + 2, sizey + 2, sizez + 2)) + var chunk_aabb : AABB = AABB(chunk.get_position() * Vector3(chunk.size_x, chunk.size_y, chunk.size_z), Vector3(chunk.size_x, chunk.size_y, chunk.size_z)) if dung_entrance_scene && chunk_aabb.has_point(entrance_position.origin): inner_entrance_position = Vector3(player_inner_entrance_position_x * chunk.voxel_scale, (posy + 2) * chunk.voxel_scale + 0.3, player_inner_entrance_position_z * chunk.voxel_scale) @@ -102,7 +129,10 @@ func _generate_chunk(chunk, spawn_mobs): if !aabb.intersects(chunk_aabb): return - + + if chunk.position_y != 0: + return + var px : int = chunk.position_x * chunk.size_x - posx var pz : int = chunk.position_z * chunk.size_z - posz @@ -115,7 +145,7 @@ func _generate_chunk(chunk, spawn_mobs): if toz > sizez: toz = sizez - var floor_pos : int = chunk.position_y * chunk.size_y - posy + var floor_pos : int = posy - chunk.position_y * chunk.size_y var ceiling_pos : int = floor_pos + sizey var draw_floor : bool = true 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 d2d5367e..35ebef1d 100644 --- a/game/modules/planets/test_planet/planets/dung_simple_planet.gd +++ b/game/modules/planets/test_planet/planets/dung_simple_planet.gd @@ -21,27 +21,24 @@ extends Planet # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. + + func _setup(): - if data == null: - return - - if data.get_biome_data_count() == 0: + if get_biome_count() == 0: return - var bdata : BiomeData = data.get_biome_data(0) + var b : Biome = get_biome(0) - if !bdata: + if !b: return - var b : Biome = bdata.instance() b.current_seed = current_seed b.setup() - add_biome(b) # if bdata.get_dungeon_data_count() == 0: # return # -# var dd : DungeonData = bdata.get_dungeon_data(0) +# var dd : Dungeon = bdata.get_dungeon_data(0) # # var dung : Dungeon = dd.instance() # @@ -56,7 +53,7 @@ func _setup(): func _generate_chunk(chunk, spawn_mobs): if (get_biome_count() == 0): return - + var b : Biome = get_biome(0) b.generate_chunk(chunk, spawn_mobs) diff --git a/game/modules/planets/test_planet/planets/simple_planet.gd b/game/modules/planets/test_planet/planets/simple_planet.gd index 77e7d600..b59cdfc5 100644 --- a/game/modules/planets/test_planet/planets/simple_planet.gd +++ b/game/modules/planets/test_planet/planets/simple_planet.gd @@ -22,19 +22,11 @@ extends Planet # SOFTWARE. func _setup(): - if data == null: + if get_biome_count() == 0: return - if data.get_biome_data_count() == 0: - return - - var bdata : BiomeData = data.get_biome_data(0) - - var b : Biome = bdata.instance() - - b.current_seed = current_seed + var b : Biome = get_biome(0) b.setup() - add_biome(b) #func _setup_library(library): # ._setup_library(library) diff --git a/game/scenes/World.tscn b/game/scenes/World.tscn index f6e00cae..c884bceb 100644 --- a/game/scenes/World.tscn +++ b/game/scenes/World.tscn @@ -4,7 +4,7 @@ [ext_resource path="res://modules/planets/test_planet/voxel_library/1_main_lib_merger_empty.tres" type="VoxelmanLibraryMerger" id=2] [ext_resource path="res://scripts/settings/DirectionalLightSettings.gd" type="Script" id=3] [ext_resource path="res://test_props/MeshDataInstance.tres" type="PropData" id=4] -[ext_resource path="res://modules/planets/test_planet/DungeonPlanetData.tres" type="PlanetData" id=5] +[ext_resource path="res://modules/planets/test_planet/DungeonPlanetData.tres" type="Planet" id=5] [ext_resource path="res://voxelman/world/TVVoxelWorld.gd" type="Script" id=8] [sub_resource type="VoxelmanLevelGenerator" id=1] diff --git a/game/scripts/world_generators/MainPlanetGenerator.gd b/game/scripts/world_generators/MainPlanetGenerator.gd index 351c0de4..d3e25bc2 100644 --- a/game/scripts/world_generators/MainPlanetGenerator.gd +++ b/game/scripts/world_generators/MainPlanetGenerator.gd @@ -27,7 +27,7 @@ const planet_folder : String = "res://modules/planets" export(int) var _force_planet : int = -1 export(int) var _level_seed : int export(bool) var _spawn_mobs : bool -export(PlanetData) var planet : PlanetData = null +export(Planet) var planet : Planet = null var _world : VoxelWorld var _planet : Planet @@ -40,7 +40,7 @@ func setup(world : VoxelWorld, level_seed : int, spawn_mobs : bool, library: Vox _library = library if planet != null: - _planet = planet.instance() + _planet = planet.instance(_level_seed) _planet.current_seed = _level_seed _planet.setup() _planet.setup_library(_library) @@ -67,7 +67,7 @@ func create_planet(): else: ind = _force_planet - var planet_data : PlanetData = ResourceLoader.load(planet_files[ind], "PlanetData") + var planet_data : Planet = ResourceLoader.load(planet_files[ind], "Planet") if planet_data == null: print("planet_data is null!") @@ -75,7 +75,7 @@ func create_planet(): print("planet loaded: " + planet_data.resource_path) - _planet = planet_data.instance() + _planet = planet_data.instance(_level_seed) _planet.current_seed = _level_seed _planet.data = planet_data diff --git a/game/voxelman/world/TVVoxelWorld.gd b/game/voxelman/world/TVVoxelWorld.gd index 82b18fe7..044157f5 100644 --- a/game/voxelman/world/TVVoxelWorld.gd +++ b/game/voxelman/world/TVVoxelWorld.gd @@ -49,7 +49,6 @@ var rc : int = 0 func _enter_tree(): if generate_on_ready and not Engine.is_editor_hint(): -# This crashes pretty reliably, when duplicatiog BiomeBase, not yet sure why exactly # call_deferred("generate") generate()