Files
mtgodot-poc/project/player_motion_test.gd
T

46 lines
1.5 KiB
GDScript

# player_motion_test —— 40250 GC_MOTION / ServerCommand emotion clip mapping。
# godot --headless --path project --script player_motion_test.gd
extends SceneTree
const PlayerView = preload("res://ui/player_view.gd")
var _fail := 0
func _ck(ok: bool, msg: String) -> void:
if not ok:
_fail += 1
printerr("FAIL: " + msg)
func _init() -> void:
await _run()
if _fail == 0:
print("PASS: player_motion_test")
quit(0)
else:
printerr("%d check(s) failed" % _fail)
quit(1)
func _run() -> void:
if not ClassDB.class_exists("Metin2Model") or not ClassDB.class_exists("Metin2AnimPlayer"):
print(" (skip: animation extension not registered)")
return
var assets := AssetRoot.path()
if not DirAccess.dir_exists_absolute(assets.path_join("PC/ymir work/pc/warrior")):
print(" (skip: PC assets unavailable)")
return
var pv: Node = PlayerView.new()
get_root().add_child(pv)
_ck(pv.build(assets, 0), "warrior PlayerView builds")
if pv.anim == null:
return
_ck(pv.set_motion_id(305), "clap motion resolves")
_ck(String(pv.anim.get("anim_path")).ends_with("action/clap.msa"),
"clap -> action/clap.msa")
_ck(pv.set_motion_id(308, 3), "kiss motion resolves with target job")
_ck(String(pv.anim.get("anim_path")).ends_with("action/kiss_with_shaman.msa"),
"kiss start + shaman target -> kiss_with_shaman.msa")
_ck(pv.set_motion_id(320), "slap hurt motion resolves")
_ck(String(pv.anim.get("anim_path")).ends_with("action/slap_hurt.msa"),
"slap hurt -> action/slap_hurt.msa")
pv.queue_free()