Now the dungeon gets generated properly at any y coordinate. Set it to -50.

This commit is contained in:
Relintai 2020-07-22 22:05:10 +02:00
parent 6044d301c1
commit e95f5ac67e
2 changed files with 7 additions and 5 deletions

View File

@ -106,8 +106,6 @@ func _setup():
# #
# add_dungeon_start_room(dung) # add_dungeon_start_room(dung)
posy = 5
build() build()
func _setup_library(library): func _setup_library(library):
@ -129,9 +127,6 @@ func _generate_chunk(chunk, spawn_mobs):
if !aabb.intersects(chunk_aabb): if !aabb.intersects(chunk_aabb):
return return
if chunk.position_y != 0:
return
var px : int = chunk.position_x * chunk.size_x - posx var px : int = chunk.position_x * chunk.size_x - posx
var pz : int = chunk.position_z * chunk.size_z - posz 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_floor : bool = true
var draw_ceiling : bool = true var draw_ceiling : bool = true
if floor_pos > chunk.size_y:
return
if ceiling_pos < 0:
return
if floor_pos < 0: if floor_pos < 0:
floor_pos = 0 floor_pos = 0
draw_floor = false draw_floor = false

View File

@ -13,6 +13,7 @@
[ext_resource path="res://modules/planets/test_planet/voxel_library/textures/stone_dungeon_1_albedo.png" type="Texture" id=11] [ext_resource path="res://modules/planets/test_planet/voxel_library/textures/stone_dungeon_1_albedo.png" type="Texture" id=11]
[resource] [resource]
posy = -50
sizex = 40 sizex = 40
sizey = 3 sizey = 3
sizez = 40 sizez = 40