Files
mtgodot-poc/project/motion_event_visibility_test.gd
T
shenandshen c93894313a fix: 装备属性面板避让逻辑 + 多项功能更新
- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧
- inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域
- 包含其他累积的功能开发和测试文件
2026-09-21 16:38:59 -07:00

39 lines
1.0 KiB
GDScript

# motion_event_visibility_test —— 40250 CHARACTER_SHOW/HIDE local consumer.
extends SceneTree
const GameScene = preload("res://game_scene.gd")
class Actor extends Node3D:
var hidden := false
func set_motion_hidden(value: bool) -> void:
hidden = value
func is_motion_hidden() -> bool:
return hidden
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 game := GameScene.new()
var actor := Actor.new()
get_root().add_child(game)
get_root().add_child(actor)
game.player = actor
game._on_local_motion_event_detailed({"type": 8, "sound": "", "pos": Vector3.ZERO})
check(actor.hidden, "CHARACTER_HIDE reaches the local actor")
game._on_local_motion_event_detailed({"type": 7, "sound": "", "pos": Vector3.ZERO})
check(not actor.hidden, "CHARACTER_SHOW restores the local actor")
game.free()
actor.free()
await process_frame
if failures == 0:
print("PASS: motion_event_visibility_test")
quit(1 if failures else 0)