From e95f5ac67e36eda06fae77cb954e70f40b87dc72 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 22 Jul 2020 22:05:10 +0200 Subject: [PATCH] Now the dungeon gets generated properly at any y coordinate. Set it to -50. --- game/modules/planets/test_planet/dungeons/dungeon.gd | 11 ++++++----- .../modules/planets/test_planet/dungeons/dungeon.tres | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/game/modules/planets/test_planet/dungeons/dungeon.gd b/game/modules/planets/test_planet/dungeons/dungeon.gd index 211331a9..0d8f9627 100644 --- a/game/modules/planets/test_planet/dungeons/dungeon.gd +++ b/game/modules/planets/test_planet/dungeons/dungeon.gd @@ -106,8 +106,6 @@ func _setup(): # # add_dungeon_start_room(dung) - posy = 5 - build() func _setup_library(library): @@ -129,9 +127,6 @@ 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 @@ -150,6 +145,12 @@ func _generate_chunk(chunk, spawn_mobs): var draw_floor : bool = true var draw_ceiling : bool = true + if floor_pos > chunk.size_y: + return + + if ceiling_pos < 0: + return + if floor_pos < 0: floor_pos = 0 draw_floor = false diff --git a/game/modules/planets/test_planet/dungeons/dungeon.tres b/game/modules/planets/test_planet/dungeons/dungeon.tres index 3e4c36df..59b54b27 100644 --- a/game/modules/planets/test_planet/dungeons/dungeon.tres +++ b/game/modules/planets/test_planet/dungeons/dungeon.tres @@ -13,6 +13,7 @@ [ext_resource path="res://modules/planets/test_planet/voxel_library/textures/stone_dungeon_1_albedo.png" type="Texture" id=11] [resource] +posy = -50 sizex = 40 sizey = 3 sizez = 40