saumwacht-godot/tools/verify_basalt.gd
Martin Stickelbroeck c2b447610c Baseline: Saumwacht 0.15.0 (Phase 20A) vor dem Umbau zu Champions of Luneraria
Unveränderter Ausgangsstand inklusive Masterprompt und Konzeptbildern
unter assets/. .godot/ und docs/screenshots/ bleiben laut .gitignore
unversioniert; letztere sind unter ../backups gesichert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 20:00:36 +02:00

46 lines
2.2 KiB
GDScript

extends Node
var checks: int = 0
var failures: Array[String] = []
func check(ok: bool, label: String) -> void:
checks += 1
if not ok:
failures.append(label)
printerr("RIG_FAIL: ", label)
func _ready() -> void:
call_deferred("run")
func run() -> void:
var a: Node3D = AssetLibrary.instantiate_fighter("g04")
var b: Node3D = AssetLibrary.instantiate_fighter("g04")
add_child(a)
add_child(b)
check(a.skeleton.get_bone_count() == 17, "17 imported bones")
check(a.player != b.player and a.skeleton != b.skeleton, "independent skeleton and playback")
for clip: String in ["idle", "start", "walk", "stop", "attack_a", "attack_b", "hit", "ability", "death"]:
check(a.clips.has(clip), "imported clip " + clip)
check(a.clip_length(clip) > .3, "clip duration " + clip)
var thigh: int = a.skeleton.find_bone("Thigh.L")
var rest: Quaternion = b.skeleton.get_bone_pose_rotation(thigh)
a.preview("walk", .40)
check(a.skeleton.get_bone_pose_rotation(thigh).angle_to(rest) > .05, "walking deforms weighted leg")
a.preview("attack_a", .90)
var hand: int = a.skeleton.find_bone("Hand.L")
check(a.skeleton.get_bone_pose_rotation(hand).angle_to(rest) > .05, "left attack moves fist")
a.preview("ability", .50)
check(a.current_clip == "ability" or a.clips.has("ability"), "defensive ability clip")
a.preview("idle", 0)
check(a.skeleton.get_bone_pose_rotation(thigh).is_equal_approx(b.skeleton.get_bone_pose_rotation(thigh)), "idle restores pose")
a.update_combat(1.0 / 60, 0, true, .6, 0, 0, 0, true)
check(a.current_clip == "attack_a", "combat uses left attack")
a.update_combat(1.0 / 60, 0, true, 0, 1, 0, 0, true)
check(absf(a.player.current_animation_position - .9) < .001, "damage frame matches contact")
a.update_combat(1.0 / 60, 0, true, .65, 1, 0, 0, true)
check(a.current_clip == "attack_b", "alternating right attack")
a.update_combat(1.0 / 60, 0, false, 0, 1, 0, 0, false)
check(a.dead and a.current_clip == "death", "death clip")
a.free()
b.free()
var f := FileAccess.open("res://docs/phase15-rig-verification.json", FileAccess.WRITE)
f.store_string(JSON.stringify({"checks": checks, "failures": failures}, "\t"))
f.close()
print("RIG_PASS: ", checks, " checks; ", failures.size(), " failures")
await Soundscape.quit_game(0 if failures.is_empty() else 1)