- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧 - inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域 - 包含其他累积的功能开发和测试文件
61 lines
2.4 KiB
GDScript
61 lines
2.4 KiB
GDScript
# motion_splash_test —— 40250 CActorInstance::SSplashArea / __SplashAttackProcess
|
|
# 的几何、生命周期、命中去重和命中上限回归。
|
|
extends SceneTree
|
|
|
|
const MotionSplash = preload("res://motion_splash.gd")
|
|
|
|
var _fail := 0
|
|
|
|
func _ck(ok: bool, message: String) -> void:
|
|
if not ok:
|
|
_fail += 1
|
|
printerr("FAIL: " + message)
|
|
|
|
func _near(a: Vector3, b: Vector3, eps := 0.01) -> bool:
|
|
return a.distance_to(b) <= eps
|
|
|
|
func _init() -> void:
|
|
_run()
|
|
if _fail == 0:
|
|
print("PASS: motion_splash_test (transform / lifetime / dedup / limit)")
|
|
quit(0)
|
|
else:
|
|
printerr("%d check(s) failed" % _fail)
|
|
quit(1)
|
|
|
|
func _run() -> void:
|
|
var event := {
|
|
"type": 4,
|
|
"duration_time": 0.5,
|
|
"enable_hit_process": false,
|
|
"attack_type": 0,
|
|
"hitting_type": 1,
|
|
"stiffen_time": 0.1,
|
|
"invisible_time": 0.2,
|
|
"external_force": 30.0,
|
|
"hit_limit_count": 1,
|
|
"collision_spheres": [{"radius": 40.0, "pos": Vector3(100, 0, 0)}],
|
|
}
|
|
var area: Dictionary = MotionSplash.begin(77, 122, Vector3.ZERO, 0.0, event, 10.0)
|
|
_ck(area.get("enable_hit_process", true) == false, "EnableHitProcess is retained")
|
|
_ck(area.get("skill", 0) == 122, "uSkill is retained")
|
|
_ck(area.get("spheres", []).size() == 1, "one splash sphere is created")
|
|
# ActorInstanceMotionEvent.cpp: fRadian = 270 + 360 - GetRotation().
|
|
# At rotation 0, source (100,0) becomes M2 (-100,0), i.e. Godot (-1,0,0).
|
|
var sphere: Dictionary = area.spheres[0]
|
|
_ck(_near(sphere.world_pos, Vector3(-1.0, 0.0, 0.0)),
|
|
"reference 270-degree event-frame transform")
|
|
|
|
var victim := [{"radius": 20.0, "pos": Vector3(-100, 0, 0), "last": Vector3(-100, 0, 0)}]
|
|
var hit: Dictionary = MotionSplash.try_hit(area, 1001, victim, 10.1)
|
|
_ck(bool(hit.get("hit", false)), "overlapping defending sphere hits")
|
|
_ck(not bool(MotionSplash.try_hit(area, 1001, victim, 10.2).get("hit", false)),
|
|
"same victim is deduplicated for the splash lifetime")
|
|
var second_victim := [{"radius": 20.0, "pos": Vector3(-100, 0, 0), "last": Vector3(-100, 0, 0)}]
|
|
_ck(not bool(MotionSplash.try_hit(area, 1002, second_victim, 10.3).get("hit", false)),
|
|
"HitLimitCount rejects the next victim after the cap")
|
|
_ck(MotionSplash.is_active(area, 10.49), "splash remains active during DuringTime")
|
|
_ck(not MotionSplash.is_active(area, 10.5), "splash expires at DuringTime")
|
|
_ck(not bool(MotionSplash.try_hit(area, 1003, victim, 10.6).get("hit", false)),
|
|
"expired splash cannot hit")
|