mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Now mobs actually won't move/fall when outside of the loaded and meshed area. Fix to mob spawning coordinates in simple biome. Also update Voxelman to grab the is_position_walkable fix.
This commit is contained in:
parent
0258425ef3
commit
f2ac08f7bc
2
HEADS
2
HEADS
@ -1 +1 @@
|
||||
{"engine": {"3.2": "f4e3701893bdf6b304ee114745def2f8ac4aa822", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "a08917370cdef0884042bdb49fb80ece0b2e76ec"}, "entity_spell_system": {"master": "3e10779dbc5258d1e1b08eab287189f9c1ccec64"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "ac75c78be10e0f7d60b7a6f26189523347732276"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "ba464ef04500aa01b2638cf1f890f3f6582ead84"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}}
|
||||
{"engine": {"3.2": "0d5e483a90c41c433056b8cf6e4e8def6316690f", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "a08917370cdef0884042bdb49fb80ece0b2e76ec"}, "entity_spell_system": {"master": "3e10779dbc5258d1e1b08eab287189f9c1ccec64"}, "ui_extensions": {"master": "38acc650db260a831dc26ca96fe9d9a087230bdc"}, "voxelman": {"master": "fbd2903477bc810fba8abec48f9cd6f9252e2fe5"}, "texture_packer": {"master": "b17c174906f84de93d84aa60d010ffe603efaa28"}, "fastnoise": {"master": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}, "mesh_data_resource": {"master": "4bda19b12be2c2a79a6121de6d22e48f3934e726"}, "procedural_animations": {"master": "ba464ef04500aa01b2638cf1f890f3f6582ead84"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}}
|
@ -64,6 +64,24 @@ func _ready() -> void:
|
||||
set_process(true)
|
||||
set_physics_process(true)
|
||||
|
||||
func _enter_tree():
|
||||
var world : VoxelWorld = get_node("..") as VoxelWorld
|
||||
|
||||
if world != null:
|
||||
if not world.is_position_walkable(get_body().transform.origin):
|
||||
world.connect("chunk_mesh_generation_finished", self, "chunk_mesh_generation_finished", [], CONNECT_DEFERRED)
|
||||
set_process(false)
|
||||
set_physics_process(false)
|
||||
|
||||
func chunk_mesh_generation_finished(chunk):
|
||||
var world : VoxelWorld = get_node("..") as VoxelWorld
|
||||
|
||||
if world.is_position_walkable(get_body().transform.origin):
|
||||
world.disconnect("chunk_mesh_generation_finished", self, "chunk_mesh_generation_finished")
|
||||
set_process(true)
|
||||
set_physics_process(true)
|
||||
|
||||
|
||||
func _process(delta : float) -> void:
|
||||
if dead:
|
||||
death_timer += delta
|
||||
|
@ -59,6 +59,7 @@ adjustment_enabled = true
|
||||
data_margin_start = 1
|
||||
data_margin_end = 2
|
||||
max_concurrent_generations = 4
|
||||
max_frame_chunk_build_steps = 1
|
||||
library = ExtResource( 2 )
|
||||
level_generator = SubResource( 1 )
|
||||
voxel_scale = 1.6
|
||||
|
@ -39,6 +39,9 @@ var _editor_generate : bool
|
||||
var _player_file_name : String
|
||||
var _player : Entity
|
||||
|
||||
const VIS_UPDATE_INTERVAL = 5
|
||||
var vis_update : float = 0
|
||||
|
||||
func _enter_tree():
|
||||
for ch in get_children():
|
||||
if ch is VoxelChunk:
|
||||
@ -51,14 +54,52 @@ func _enter_tree():
|
||||
add_chunk(c, c.position_x, c.position_y, c.position_z)
|
||||
c.build_deferred()
|
||||
|
||||
|
||||
|
||||
if generate_on_ready and not Engine.is_editor_hint():
|
||||
|
||||
if level_generator != null:
|
||||
level_generator.setup(self, 80, false, library)
|
||||
|
||||
spawn()
|
||||
|
||||
func _process(delta):
|
||||
if _player == null:
|
||||
set_process(false)
|
||||
return
|
||||
|
||||
vis_update += delta
|
||||
|
||||
if vis_update >= VIS_UPDATE_INTERVAL:
|
||||
vis_update = 0
|
||||
|
||||
var ppos : Vector3 = _player.get_body().transform.origin
|
||||
|
||||
var cpos : Vector3 = ppos
|
||||
cpos.x = int(cpos.x / (chunk_size_x * voxel_scale))
|
||||
cpos.y = int(cpos.y / (chunk_size_y * voxel_scale))
|
||||
cpos.z = int(cpos.z / (chunk_size_z * voxel_scale))
|
||||
|
||||
var count : int = get_chunk_count()
|
||||
var i : int = 0
|
||||
while i < count:
|
||||
var c : VoxelChunk = get_chunk_index(i)
|
||||
|
||||
var l : float = (Vector2(cpos.x, cpos.z) - Vector2(c.position_x, c.position_z)).length()
|
||||
|
||||
if l > chunk_spawn_range + 2:
|
||||
# print("despawn " + str(Vector3(c.position_x, c.position_y, c.position_z)))
|
||||
remove_chunk_index(i)
|
||||
c.queue_free()
|
||||
i -= 1
|
||||
count -= 1
|
||||
|
||||
i += 1
|
||||
|
||||
for x in range(-chunk_spawn_range + int(cpos.x), chunk_spawn_range + int(cpos.x)):
|
||||
for z in range(-chunk_spawn_range + int(cpos.z), chunk_spawn_range + int(cpos.z)):
|
||||
for y in range(-1, 2):
|
||||
if not has_chunk(x, y, z):
|
||||
# print("spawn " + str(Vector3(x, y, z)))
|
||||
create_chunk(x, y, z)
|
||||
|
||||
#func _process(delta : float) -> void:
|
||||
# if not generation_queue.empty():
|
||||
@ -128,7 +169,7 @@ func _create_chunk(x : int, y : int, z : int, pchunk : Node) -> VoxelChunk:
|
||||
#chunk.meshing_create_collider = false
|
||||
|
||||
chunk.lod_size = 1
|
||||
|
||||
# print("added " + str(Vector3(x, y, z)))
|
||||
return ._create_chunk(x, y, z, chunk)
|
||||
|
||||
func spawn() -> void:
|
||||
@ -199,6 +240,8 @@ func load_character(file_name : String) -> void:
|
||||
|
||||
spawn()
|
||||
|
||||
set_process(true)
|
||||
|
||||
func needs_loading_screen() -> bool:
|
||||
return show_loading_screen
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user