diff --git a/scripts/player.gd b/scripts/player.gd index c6fea50..499450d 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -337,5 +337,4 @@ func _physics_process(delta: float) -> void: ## predicted position has drifted too far. func apply_server_correction(pos: Vector3) -> void: global_position = pos - velocity.x = 0.0 - velocity.z = 0.0 + velocity = Vector3.ZERO diff --git a/scripts/server.gd b/scripts/server.gd index a8222d5..b4dca56 100644 --- a/scripts/server.gd +++ b/scripts/server.gd @@ -101,6 +101,8 @@ func _ready() -> void: if level == null: level = _fallback_level_scene.instantiate() _content_status = "fallback" + elif _chunks_loaded == 0: + _content_status = "fallback" else: _content_status = "loaded" @@ -201,12 +203,14 @@ func _try_load_real_content() -> Node: print("[Server] chunk index fetch failed (%s); falling back to test_level" % index_result.get("detail", "?")) return null - var world_root := Node3D.new() + var world_root: Node3D = _fallback_level_scene.instantiate() as Node3D world_root.name = "World" - var marker := Marker3D.new() - marker.name = "PlayerSpawn" + var marker: Marker3D = world_root.find_child("PlayerSpawn", true, false) as Marker3D + if marker == null: + marker = Marker3D.new() + marker.name = "PlayerSpawn" + world_root.add_child(marker) marker.position = spawn_pos - world_root.add_child(marker) var entries: Array = (index_result.data as Dictionary).get("chunks", []) for entry in entries: @@ -242,7 +246,10 @@ func _spawn_pos_from_room(room: Dictionary) -> Vector3: if spawn is Dictionary and (spawn as Dictionary).has("pos"): var p: Array = (spawn as Dictionary)["pos"] if p.size() >= 3: - return Vector3(float(p[0]), float(p[1]), float(p[2])) + var pos := Vector3(float(p[0]), float(p[1]), float(p[2])) + if pos.y < 1.0: + pos.y = 1.5 + return pos return Vector3(0, 1.5, 0)