mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Smaller improvements for the initial world generation.
This commit is contained in:
parent
3081388a79
commit
fc46791887
@ -41,6 +41,7 @@ var _player : Entity
|
|||||||
|
|
||||||
const VIS_UPDATE_INTERVAL = 5
|
const VIS_UPDATE_INTERVAL = 5
|
||||||
var vis_update : float = 0
|
var vis_update : float = 0
|
||||||
|
var _max_frame_chunk_build_temp : int
|
||||||
|
|
||||||
func _enter_tree():
|
func _enter_tree():
|
||||||
for ch in get_children():
|
for ch in get_children():
|
||||||
@ -62,6 +63,9 @@ func _enter_tree():
|
|||||||
spawn()
|
spawn()
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
if initial_generation:
|
||||||
|
return
|
||||||
|
|
||||||
if _player == null:
|
if _player == null:
|
||||||
set_process(false)
|
set_process(false)
|
||||||
return
|
return
|
||||||
@ -119,6 +123,8 @@ func _process(delta):
|
|||||||
# get_node("..").hide_loading_screen()
|
# get_node("..").hide_loading_screen()
|
||||||
|
|
||||||
func _generation_finished():
|
func _generation_finished():
|
||||||
|
max_frame_chunk_build_steps = _max_frame_chunk_build_temp
|
||||||
|
|
||||||
initial_generation = false
|
initial_generation = false
|
||||||
|
|
||||||
# for i in range(get_chunk_count()):
|
# for i in range(get_chunk_count()):
|
||||||
@ -135,6 +141,7 @@ func _prepare_chunk_for_generation(chunk):
|
|||||||
refresh_chunk_lod_level_data(chunk)
|
refresh_chunk_lod_level_data(chunk)
|
||||||
|
|
||||||
func refresh_chunk_lod_level_data(chunk : VoxelChunk) -> void:
|
func refresh_chunk_lod_level_data(chunk : VoxelChunk) -> void:
|
||||||
|
|
||||||
var cpx : int = chunk.position_x
|
var cpx : int = chunk.position_x
|
||||||
var cpy : int = chunk.position_y
|
var cpy : int = chunk.position_y
|
||||||
var cpz : int = chunk.position_z
|
var cpz : int = chunk.position_z
|
||||||
@ -173,6 +180,9 @@ func _create_chunk(x : int, y : int, z : int, pchunk : Node) -> VoxelChunk:
|
|||||||
return ._create_chunk(x, y, z, chunk)
|
return ._create_chunk(x, y, z, chunk)
|
||||||
|
|
||||||
func spawn() -> void:
|
func spawn() -> void:
|
||||||
|
_max_frame_chunk_build_temp = max_frame_chunk_build_steps
|
||||||
|
max_frame_chunk_build_steps = 0
|
||||||
|
|
||||||
for x in range(-chunk_spawn_range, chunk_spawn_range):
|
for x in range(-chunk_spawn_range, chunk_spawn_range):
|
||||||
for z in range(-chunk_spawn_range, chunk_spawn_range):
|
for z in range(-chunk_spawn_range, chunk_spawn_range):
|
||||||
for y in range(-1, 2):
|
for y in range(-1, 2):
|
||||||
|
Loading…
Reference in New Issue
Block a user