fix: ensure server world always includes solid ground geometry to prevent falling through floor
checkpoint / checkpoint (push) Successful in 5m57s
checkpoint / checkpoint (push) Successful in 5m57s
This commit is contained in:
+12
-5
@@ -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)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user