Files
mtgodot-poc/project/player_motion_test.gd
T
shenandshen 66d217b313 feat(client): 完成40250客户端核心功能1:1对齐与桥梁高度采样修复
- 桥梁与静态物体高度采样修复:
  - 严格对齐 40250 CMapOutdoor::GetHeight 与 CAttributeInstance::GetHeight
  - 解析 .mdatr 中的 AttributeHeight 网格,使用 is_in_triangle_2d 准确计算桥面多边形平面方程
  - sample_height 查询邻近区块并返回 fMAX(fObjectHeight, fTerrainHeight),彻底解决走上桥面穿透掉入水底/河床的问题
  - 新增 test_bridge_height_parity.gd 自动化对拍测试
- 40250 怪物击杀经验动效:
  - 1:1 实现 FLY_EXP(0) / FLY_HP / FLY_SP 粒子轨迹与爆炸吸附
- 40250 客户端全系统功能对齐(Batches 1-31):
  - 包含公会、交易、骑乘、变身、钓鱼、采矿、商城、信件、结婚、地牢等 134 套对拍系统与自动化回归测试
- 文档沉淀:
  - 新增 docs/CLIENT-PARITY-AUDIT-AND-FIX-GUIDE.md 客户端对拍缺陷发现与修复工程指南
2026-09-19 08:51:25 -07:00

69 lines
2.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")
const Audio = preload("res://audio.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
await process_frame
var body_mesh := pv.model.get_node_or_null("MeshInstance3D") as MeshInstance3D
var body_layer := body_mesh.get_layer_mask() if body_mesh != null else 0
_ck(body_mesh != null and body_layer == 2,
"character mesh is assigned to the character light layer (got %d)" % body_layer)
var audio: Node = Audio.new()
get_root().add_child(audio)
audio.setup(assets)
pv.set_audio(audio)
pv.set_anim_state("run")
_ck(pv._sound_instances.size() == 3, "PlayerView run motion loads paired .mss instances")
pv.set_motion_mode(3) # MODE_TWOHAND_SWORD
_ck(String(pv.anim.get("anim_path")).contains("/twohand_sword/run.msa"),
"two-handed mode rebinds current run loop")
pv.set_anim_state("wait")
_ck(String(pv.anim.get("anim_path")).contains("/twohand_sword/wait.msa"),
"two-handed wait uses the two-hand grip pose")
pv.play_attack_motion(3, 14, 1.0)
_ck(String(pv.anim.get("anim_path")).contains("/twohand_sword/combo_01.msa"),
"two-handed first swing uses combo_01")
pv.set_motion_mode(1)
_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()
audio.queue_free()