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

56 lines
1.7 KiB
GDScript

# damage_local_main_parity_test —— 40250 RecvDamageInfoPacket / MainInstance。
#
# 参考端即使 pInstTarget == MainInstance,也会把伤害交给
# CInstanceBase::AddDamageEffect;当前端的本地主角不在 _by_vid,而是由
# NetWorld._local_node 单独持有,因此必须走同一条本地节点回退路径。
#
# 修复前:本地 VID 的伤害进入队列后,在 _process_damage_queue() 因 _by_vid
# 查不到节点而被丢弃;修复后:应创建 dmg_<vid> 飘字节点。
extends SceneTree
const NetWorld = preload("res://net_world.gd")
var _fail := 0
func _ck(condition: bool, message: String) -> void:
if not condition:
_fail += 1
printerr("FAIL: " + message)
func _init() -> void:
call_deferred("_run")
func _run() -> void:
var parent := Node3D.new()
root.add_child(parent)
var local := Node3D.new()
local.name = "LocalMain"
parent.add_child(local)
local.position = Vector3(2.0, 0.0, 3.0)
var nw := NetWorld.new()
root.add_child(nw)
# 直接建立 GameScene.setup() 为本地主角设置的关键状态,避免测试把
# 普通 _by_vid actor 当成本地主角,掩盖 MainInstance 分支。
nw.parent = parent
nw._local_vid = 1000
nw._main_vid = 1000
nw._target_vid = 1000
nw._local_node = local
nw._show_damage = true
nw._on_damage(1000, 123, 0)
_ck(nw._damage_queue.size() == 1, "MainInstance damage is queued")
nw._process_damage_queue()
_ck(parent.get_node_or_null("dmg_1000") != null,
"MainInstance damage creates the local damage billboard")
if _fail == 0:
print("PASS: damage_local_main_parity_test (MainInstance damage billboard)")
quit(0)
else:
printerr("%d check(s) failed" % _fail)
quit(1)