- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧 - inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域 - 包含其他累积的功能开发和测试文件
51 lines
1.6 KiB
GDScript
51 lines
1.6 KiB
GDScript
# fly_reset_test —— Loading/map change must remove active projectiles and flashes.
|
|
# godot --headless --path project --script fly_reset_test.gd
|
|
extends SceneTree
|
|
|
|
const FlyObject = preload("res://fly_object.gd")
|
|
|
|
var _fail := 0
|
|
|
|
func _ck(condition: bool, message: String) -> void:
|
|
if not condition:
|
|
_fail += 1
|
|
printerr("FAIL: " + message)
|
|
|
|
func _init() -> void:
|
|
await _run()
|
|
if _fail == 0:
|
|
print("PASS: fly_reset_test")
|
|
quit(0)
|
|
else:
|
|
printerr("%d check(s) failed" % _fail)
|
|
quit(1)
|
|
|
|
func _run() -> void:
|
|
var host := Node3D.new()
|
|
var manager := FlyObject.new()
|
|
get_root().add_child(host)
|
|
get_root().add_child(manager)
|
|
manager.manual_step = true
|
|
manager.setup(host)
|
|
|
|
var data := FlyObject.FlyData.new()
|
|
data.init_vel = 1.0
|
|
data.flat_range = 10.0
|
|
manager.spawn(Vector3.ZERO, Vector3(0.0, 0.0, -1.0), true, data)
|
|
manager._spawn_flash(Vector3.ZERO, FlyObject.FLY_EXP)
|
|
_ck(manager.active_count() == 1, "active projectile is tracked before reset")
|
|
_ck(host.get_child_count() == 2, "projectile and flash visuals exist before reset")
|
|
|
|
manager.clear_for_map_change()
|
|
_ck(manager.active_count() == 0, "reset removes all active projectiles")
|
|
await process_frame
|
|
_ck(host.get_child_count() == 0, "reset removes projectile and flash visuals")
|
|
|
|
# clear_for_map_change already removed all visuals. At this point the
|
|
# short-lived regression owns empty manager nodes, so destroy them
|
|
# synchronously like CFlyingManager::DeleteAllInstances/Destroy instead of
|
|
# queueing a free immediately before SceneTree.quit().
|
|
host.free()
|
|
manager.free()
|
|
await process_frame
|