Refactor rhythm action architecture

This commit is contained in:
wxm
2026-07-02 09:47:52 -07:00
parent fc941cf08d
commit e62ed84518
124 changed files with 7516 additions and 2440 deletions

View File

@@ -11,26 +11,31 @@ var failures: Array[String] = []
func _init() -> void:
_run.call_deferred()
func _run() -> void:
var scene: PackedScene = load("res://scenes/characters/player.tscn")
if scene == null:
push_error("Could not load player.tscn")
quit(1)
return
var player: Node = scene.instantiate()
get_root().add_child(player)
await process_frame
var animation_player: AnimationPlayer = player.get_node("AnimationPlayer") as AnimationPlayer
_expect_action_has_key("player_w", KEY_W)
_expect_action_has_key("player_a", KEY_A)
_expect_action_has_key("player_d", KEY_D)
_expect_action_has_key("player_s", KEY_S)
_expect_action_has_key("player_space", KEY_SPACE)
_expect_action_has_key("combo_w", KEY_W)
_expect_action_has_key("combo_a", KEY_A)
_expect_action_has_key("combo_d", KEY_D)
_expect_action_has_key("combo_s", KEY_S)
_expect_action_has_key("combo_space", KEY_SPACE)
_expect_warrior_animation(animation_player, "warrior_idle", 1, 8)
_expect_warrior_animation(animation_player, "warrior_w", 6, 6)
_expect_warrior_animation(animation_player, "warrior_wa", 7, 5)
_expect_warrior_animation(animation_player, "warrior_s", 9, 10)
_expect_warrior_animation(animation_player, "warrior_s", 9, 3)
_expect_warrior_animation(animation_player, "warrior_a", 10, 7)
_expect_warrior_animation(animation_player, "warrior_aa", 11, 5)
_expect_warrior_animation(animation_player, "warrior_aaa", 12, 8)
@@ -42,24 +47,26 @@ func _init() -> void:
_expect_warrior_animation(animation_player, "warrior_a_space_space", 15, 12)
_expect_warrior_animation(animation_player, "warrior_a_space", 17, 10)
_expect_charge_effect(player)
if animation_player.has_animation("player_punch"):
failures.append("Old player_punch animation should be removed")
if animation_player.has_animation("挥砍"):
failures.append("Old slash animation should be removed")
player.call("submit_combo_input", "W")
player.call("submit_combo_input", "W", "perfect")
_expect_string(str(player.get("last_requested_skill_id")), "skill_w", "W alone should request row 6 skill")
_expect_string(str(player.get("current_skill_animation")), "warrior_w", "W alone should play warrior_w")
player.call("submit_combo_input", "A")
player.call("submit_combo_input", "A", "perfect")
await create_timer(0.55).timeout
await physics_frame
_expect_string(str(player.get("last_requested_skill_id")), "skill_wa", "W+A should request row 7 skill")
_expect_string(str(player.get("current_skill_animation")), "warrior_wa", "W+A should play warrior_wa")
var projectile := PlayerProjectile.new()
get_root().add_child(projectile)
_expect_projectile_animation(projectile)
projectile.queue_free()
player.queue_free()
_finish()