43 lines
1.1 KiB
GDScript
43 lines
1.1 KiB
GDScript
extends SceneTree
|
|
|
|
var failures: Array[String] = []
|
|
|
|
|
|
func _init() -> void:
|
|
var scene: PackedScene = load("res://scenes/main/main.tscn")
|
|
if scene == null:
|
|
push_error("Could not load main.tscn")
|
|
quit(1)
|
|
return
|
|
|
|
var main: Node = scene.instantiate()
|
|
if main.get_script() == null:
|
|
failures.append("Main script failed to load")
|
|
var required_nodes := [
|
|
"RhythmConductor",
|
|
"RhythmFeedback",
|
|
"Player",
|
|
]
|
|
for node_name: String in required_nodes:
|
|
if not main.has_node(node_name):
|
|
failures.append("Missing required node: %s" % node_name)
|
|
|
|
if main.has_node("RhythmConductor"):
|
|
var conductor: Node = main.get_node("RhythmConductor")
|
|
if not conductor.has_method("judge_action"):
|
|
failures.append("RhythmConductor missing judge_action")
|
|
if not conductor is AudioStreamPlayer:
|
|
failures.append("RhythmConductor should be an AudioStreamPlayer")
|
|
elif (conductor as AudioStreamPlayer).stream == null:
|
|
failures.append("RhythmConductor should have a music stream")
|
|
|
|
main.free()
|
|
|
|
if failures.is_empty():
|
|
print("PASS rhythm scene")
|
|
quit(0)
|
|
else:
|
|
for failure: String in failures:
|
|
push_error(failure)
|
|
quit(1)
|