- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧 - inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域 - 包含其他累积的功能开发和测试文件
73 lines
2.5 KiB
GDScript
73 lines
2.5 KiB
GDScript
# remote_motion_fly_test —— 40250 CActorInstance::ProcessMotionEventFly 的远端回归。
|
|
# 验证 GC_FLY_TARGETING 目标队列在远端 MSA FLY 事件帧创建资源飞行物,且消费
|
|
# 正确目标、保留 owner VID / skill index,并使用动作位置作为起点。
|
|
extends SceneTree
|
|
|
|
const AssetRoot = preload("res://asset_root.gd")
|
|
const FlyObject = preload("res://fly_object.gd")
|
|
const NetWorld = preload("res://net_world.gd")
|
|
|
|
class Anim extends Node:
|
|
signal motion_event_detailed(event: Dictionary)
|
|
|
|
class Actor extends Node3D:
|
|
var anim := Anim.new()
|
|
func _init() -> void:
|
|
add_child(anim)
|
|
|
|
var failures := 0
|
|
|
|
func check(ok: bool, label: String) -> void:
|
|
if not ok:
|
|
failures += 1
|
|
printerr("FAIL: " + label)
|
|
|
|
func _init() -> void:
|
|
call_deferred("run")
|
|
|
|
func run() -> void:
|
|
var world := NetWorld.new()
|
|
var mount := Node3D.new()
|
|
var actor := Actor.new()
|
|
var target := Node3D.new()
|
|
get_root().add_child(world)
|
|
get_root().add_child(mount)
|
|
mount.add_child(actor)
|
|
mount.add_child(target)
|
|
actor.position = Vector3.ZERO
|
|
target.position = Vector3(4.0, 0.0, 0.0)
|
|
world._by_vid[42] = actor
|
|
world._by_vid[99] = target
|
|
actor.set_meta("vid", 42)
|
|
world._assets_root = AssetRoot.path()
|
|
world._fly_mgr = FlyObject.new()
|
|
world.add_child(world._fly_mgr)
|
|
world._fly_mgr.setup(mount, null, world._assets_root)
|
|
world._connect_actor_motion_events(actor, 42)
|
|
world._on_fly_targeting(42, 99, Vector2.ZERO, false)
|
|
var event := {
|
|
"type": 6,
|
|
"fly_file": "d:/ymir work/pc/assassin/effect/arrow_01_fast.msf",
|
|
"fly_pos": Vector3(0.0, 0.0, 0.0),
|
|
"fly_attaching": false,
|
|
"skill_index": 7,
|
|
}
|
|
actor.anim.motion_event_detailed.emit(event)
|
|
check(world._fly_mgr.active_count() == 1,
|
|
"remote MSA FLY -> creates one resource-driven projectile")
|
|
check((world._fly_mgr._instances[0] as FlyObject.FlyInstance)._owner_vid == 42,
|
|
"remote projectile owner VID follows actor")
|
|
check((world._fly_mgr._instances[0] as FlyObject.FlyInstance).skill_index == 7,
|
|
"remote projectile skill index follows motion event")
|
|
check((actor.get_meta("fly_target_queue", []) as Array).is_empty(),
|
|
"remote MSA FLY consumes current FlyTarget exactly once")
|
|
check((world._fly_mgr._instances[0] as FlyObject.FlyInstance).target_position().distance_to(target.position) < 0.01,
|
|
"remote projectile keeps the queued object target")
|
|
world._fly_mgr.clear_for_map_change()
|
|
world.free()
|
|
mount.free()
|
|
await process_frame
|
|
if failures == 0:
|
|
print("PASS: remote_motion_fly_test")
|
|
quit(1 if failures else 0)
|