Refactor rhythm action architecture
This commit is contained in:
@@ -9,30 +9,24 @@ func _init() -> void:
|
||||
push_error("Could not load main.tscn")
|
||||
quit(1)
|
||||
return
|
||||
|
||||
var main: Node = scene.instantiate()
|
||||
|
||||
var main := 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)
|
||||
|
||||
for node_path: String in ["Stage", "Stage/ActorsContainer/Player", "ChartRunner", "UI"]:
|
||||
if not main.has_node(node_path):
|
||||
failures.append("Missing required node: %s" % node_path)
|
||||
|
||||
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")
|
||||
|
||||
failures.append("RhythmConductor should be promoted to RhythmManager autoload")
|
||||
if not ProjectSettings.has_setting("autoload/RhythmManager"):
|
||||
failures.append("RhythmManager autoload should be configured")
|
||||
|
||||
main.free()
|
||||
|
||||
_finish()
|
||||
|
||||
|
||||
func _finish() -> void:
|
||||
if failures.is_empty():
|
||||
print("PASS rhythm scene")
|
||||
quit(0)
|
||||
|
||||
Reference in New Issue
Block a user