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