84 lines
2.3 KiB
GDScript
84 lines
2.3 KiB
GDScript
extends SceneTree
|
|
|
|
const MainScene: PackedScene = preload("res://main/main.tscn")
|
|
|
|
|
|
func _initialize() -> void:
|
|
call_deferred("_run")
|
|
|
|
|
|
func _run() -> void:
|
|
root.size = Vector2i(1280, 720)
|
|
var main: Node = MainScene.instantiate()
|
|
root.add_child(main)
|
|
for _frame: int in 4:
|
|
await process_frame
|
|
if not bool(main.get("_application_initialized")):
|
|
main.call("_activate_selected_data_path", "", true)
|
|
for _frame: int in 8:
|
|
await process_frame
|
|
assert(bool(main.get("_application_initialized")))
|
|
assert(bool(main.call(
|
|
"_apply_world",
|
|
WorldLayout.GENERATED,
|
|
PlayerSaveManager.DEFAULT_WORLD_SEED,
|
|
true,
|
|
)))
|
|
var weather := main.get_node(
|
|
"%WorldWeatherService"
|
|
) as WorldWeatherService
|
|
assert(weather != null)
|
|
weather.apply_authoritative_snapshot(
|
|
WorldWeatherService.Weather.RAINY,
|
|
60.0,
|
|
)
|
|
main.call("_set_gameplay_active", true)
|
|
await physics_frame
|
|
await physics_frame
|
|
|
|
var puddles := main.get_node(
|
|
"RainPuddlePresentation"
|
|
) as RainPuddlePresentation
|
|
assert(puddles != null)
|
|
assert(not puddles.is_light_performance_profile())
|
|
assert(puddles.is_processing())
|
|
puddles.set_suppressed(true)
|
|
assert(not puddles.is_processing())
|
|
puddles.set_suppressed(false)
|
|
assert(puddles.is_processing())
|
|
puddles.set_active(false)
|
|
assert(not puddles.is_processing())
|
|
puddles.set_active(true)
|
|
assert(puddles.is_processing())
|
|
for _tick: int in 18:
|
|
puddles.call("_process", 0.25)
|
|
assert(puddles.get_active_puddle_count() > 0)
|
|
var visual_root := puddles.get_node("PuddleVisuals") as Node3D
|
|
assert(visual_root != null)
|
|
for puddle_visual: Node in visual_root.get_children():
|
|
assert(puddle_visual is MeshInstance3D)
|
|
assert(puddle_visual.get_child_count() == 0)
|
|
|
|
weather.apply_authoritative_snapshot(
|
|
WorldWeatherService.Weather.SUNNY,
|
|
60.0,
|
|
)
|
|
puddles.call("_process", 30.0)
|
|
assert(puddles.get_active_puddle_count() == 0)
|
|
_stop_audio_players(main)
|
|
main.queue_free()
|
|
for _frame: int in 8:
|
|
await process_frame
|
|
print("Rain puddle runtime validation: PASS")
|
|
quit()
|
|
|
|
|
|
func _stop_audio_players(root_node: Node) -> void:
|
|
if root_node is AudioStreamPlayer:
|
|
(root_node as AudioStreamPlayer).stop()
|
|
elif root_node is AudioStreamPlayer2D:
|
|
(root_node as AudioStreamPlayer2D).stop()
|
|
elif root_node is AudioStreamPlayer3D:
|
|
(root_node as AudioStreamPlayer3D).stop()
|
|
for child: Node in root_node.get_children():
|
|
_stop_audio_players(child)
|