fix: ensure server world always includes solid ground geometry to prevent falling through floor
checkpoint / checkpoint (push) Successful in 5m57s

This commit is contained in:
2026-09-16 19:21:11 +00:00
parent 41d1f7438c
commit e54ff6eeb2
2 changed files with 13 additions and 7 deletions
+1 -2
View File
@@ -337,5 +337,4 @@ func _physics_process(delta: float) -> void:
## predicted position has drifted too far. ## predicted position has drifted too far.
func apply_server_correction(pos: Vector3) -> void: func apply_server_correction(pos: Vector3) -> void:
global_position = pos global_position = pos
velocity.x = 0.0 velocity = Vector3.ZERO
velocity.z = 0.0
+11 -4
View File
@@ -101,6 +101,8 @@ func _ready() -> void:
if level == null: if level == null:
level = _fallback_level_scene.instantiate() level = _fallback_level_scene.instantiate()
_content_status = "fallback" _content_status = "fallback"
elif _chunks_loaded == 0:
_content_status = "fallback"
else: else:
_content_status = "loaded" _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", "?")) print("[Server] chunk index fetch failed (%s); falling back to test_level" % index_result.get("detail", "?"))
return null return null
var world_root := Node3D.new() var world_root: Node3D = _fallback_level_scene.instantiate() as Node3D
world_root.name = "World" world_root.name = "World"
var marker := Marker3D.new() var marker: Marker3D = world_root.find_child("PlayerSpawn", true, false) as Marker3D
if marker == null:
marker = Marker3D.new()
marker.name = "PlayerSpawn" marker.name = "PlayerSpawn"
marker.position = spawn_pos
world_root.add_child(marker) world_root.add_child(marker)
marker.position = spawn_pos
var entries: Array = (index_result.data as Dictionary).get("chunks", []) var entries: Array = (index_result.data as Dictionary).get("chunks", [])
for entry in entries: 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"): if spawn is Dictionary and (spawn as Dictionary).has("pos"):
var p: Array = (spawn as Dictionary)["pos"] var p: Array = (spawn as Dictionary)["pos"]
if p.size() >= 3: 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) return Vector3(0, 1.5, 0)