no message

This commit is contained in:
shenlei
2026-09-16 22:15:52 +09:00
parent 400e3e8ea5
commit 1db9e9a129
11 changed files with 458 additions and 30 deletions
+22 -1
View File
@@ -30,6 +30,8 @@ const STATE_MOTIONS := {
"standup_back": ["BACK_STANDUP"],
}
const HitReaction = preload("res://ui/hit_reaction.gd")
const MsaMotion = preload("res://ui/msa_motion.gd")
const MOVE_STATES := ["walk", "run"]
const HitCollision = preload("res://hit_collision.gd")
# CActorInstance::__SetMotion 尾:动作绑定完成。
@@ -42,6 +44,7 @@ var _mesh_stem := ""
var _hit := HitReaction.new()
var _motions := {} # MOTION_NAME(String) -> 绝对 .msa 路径
var _state := ""
var _move_speed_ratio := 1.0
var _last_resolution := {}
var _audio: Node
var _sound_instances: Array = []
@@ -156,7 +159,25 @@ func set_anim_state(s: String) -> void:
if msa == "":
# 旧客户端 GetMotionKey 失败时 SetLoopMotion/InterceptMotion 直接返回:保留当前动作。
return
_bind(s, msa, s in HitReaction.LOOP_STATES, 1.0)
_bind(s, msa, s in HitReaction.LOOP_STATES, _loop_speed(s))
# CActorInstance::SetMoveSpeedm_fMovSpd = movSpd / 100,走 / 跑循环动作按它播放
# Move -> SetLoopMotion(WALK/RUN, 0.15, m_fMovSpd))。>1100 时参考端不走动作累计,
# EntityStore 退回按 duration 插值,这里保持原速播放。
func set_move_speed(moving_speed: int) -> void:
_move_speed_ratio = 1.0 if moving_speed <= 0 or moving_speed > 1100 \
else float(moving_speed) / 100.0
if anim != null and _state in MOVE_STATES and not _hit.active:
anim.set("time_scale", _hit.scale_for(_move_speed_ratio))
func _loop_speed(state: String) -> float:
return _move_speed_ratio if state in MOVE_STATES else 1.0
## 走 / 跑动作的根运动速度(cm/smovSpd 100):x = walky = run。0 = 取不到。
## net_world 推给 EntityStore,远端移动按动作累计量推进(CActorInstance::AccumulationMovement)。
func get_move_motion_speeds() -> Vector2:
return Vector2(MsaMotion.move_speed(String(resolve_motion("walk").path)),
MsaMotion.move_speed(String(resolve_motion("run").path)))
# CGraphicThingInstance::InsertDelay(fStiffenTime)
func insert_delay(d: float) -> void: