PC2: Build a basic playable test level scene #48
@@ -34,8 +34,10 @@ func _run() -> void:
|
||||
quit(1)
|
||||
return
|
||||
|
||||
# Add to tree so find_child works
|
||||
add_child(level_instance)
|
||||
# Create a temporary root node and add it to the tree so find_child works
|
||||
var root_holder := Node3D.new()
|
||||
add_child(root_holder)
|
||||
root_holder.add_child(level_instance)
|
||||
await process_frame
|
||||
|
||||
# (b) Find the PlayerSpawn marker
|
||||
@@ -43,6 +45,7 @@ func _run() -> void:
|
||||
if spawn_marker == null:
|
||||
printerr("SMOKE RESULT: FAIL — no Marker3D named 'PlayerSpawn' found in test level")
|
||||
level_instance.queue_free()
|
||||
root_holder.queue_free()
|
||||
quit(1)
|
||||
return
|
||||
|
||||
@@ -56,6 +59,7 @@ func _run() -> void:
|
||||
printerr("SMOKE RESULT: FAIL — PlayerSpawn y = ", spawn_y,
|
||||
" is below the required minimum of 1.0 m above ground top (y=0)")
|
||||
level_instance.queue_free()
|
||||
root_holder.queue_free()
|
||||
quit(1)
|
||||
return
|
||||
|
||||
@@ -66,6 +70,7 @@ func _run() -> void:
|
||||
if ground == null:
|
||||
printerr("SMOKE RESULT: FAIL — no StaticBody3D named 'Ground' found")
|
||||
level_instance.queue_free()
|
||||
root_holder.queue_free()
|
||||
quit(1)
|
||||
return
|
||||
|
||||
@@ -79,6 +84,7 @@ func _run() -> void:
|
||||
if abs(ground_top - 0.0) > 0.01:
|
||||
printerr("SMOKE RESULT: FAIL — Ground top face at y = ", ground_top, " expected ~0.0")
|
||||
level_instance.queue_free()
|
||||
root_holder.queue_free()
|
||||
quit(1)
|
||||
return
|
||||
print("SMOKE: Ground top face at y = ", ground_top, " — PASS")
|
||||
@@ -93,12 +99,14 @@ func _run() -> void:
|
||||
if prop_count < 3:
|
||||
printerr("SMOKE RESULT: FAIL — only ", prop_count, " props found, need >= 3")
|
||||
level_instance.queue_free()
|
||||
root_holder.queue_free()
|
||||
quit(1)
|
||||
return
|
||||
print("SMOKE: found ", prop_count, " props — PASS")
|
||||
else:
|
||||
printerr("SMOKE RESULT: FAIL — no 'Props' Node3D found")
|
||||
level_instance.queue_free()
|
||||
root_holder.queue_free()
|
||||
quit(1)
|
||||
return
|
||||
|
||||
@@ -107,6 +115,7 @@ func _run() -> void:
|
||||
if sun == null:
|
||||
printerr("SMOKE RESULT: FAIL — no DirectionalLight3D named 'Sun' found")
|
||||
level_instance.queue_free()
|
||||
root_holder.queue_free()
|
||||
quit(1)
|
||||
return
|
||||
print("SMOKE: found Sun DirectionalLight3D")
|
||||
@@ -115,6 +124,7 @@ func _run() -> void:
|
||||
if env == null:
|
||||
printerr("SMOKE RESULT: FAIL — no WorldEnvironment named 'Environment' found")
|
||||
level_instance.queue_free()
|
||||
root_holder.queue_free()
|
||||
quit(1)
|
||||
return
|
||||
print("SMOKE: found WorldEnvironment")
|
||||
@@ -122,4 +132,5 @@ func _run() -> void:
|
||||
# All checks passed
|
||||
print("SMOKE RESULT: PASS")
|
||||
level_instance.queue_free()
|
||||
root_holder.queue_free()
|
||||
quit(0)
|
||||
|
||||
Reference in New Issue
Block a user