--- scripts/ui/equip_window.gd +++ scripts/ui/equip_window.gd @@ -25,8 +25,28 @@ static var _portraits: Dictionary = {} ## hud.gd hook: builds the equipment window into its body. Returns true (the old list is not built). +static var _sig := "" + + +## What the window shows; the body is rebuilt only when this changes. PlayerState.changed fires on every HP / SP +## tick in combat, and a rebuild between mouse-down and mouse-up swallowed clicks (owner bug 2026-09-30: the 3D +## button "did nothing"). +static func signature() -> String: + var ps = PlayerState + var br := "" + if load("res://scripts/ui/v2_ui.gd").on() and ps.ch != null: + br = str(load("res://scripts/server/combat_v2.gd").battle_rating(ps.ch)) + return JSON.stringify([ps.equipment, str(ps.job), show_3d, int(ps.base_lv), int(ps.job_lv), ps.stats, str(ps.char_name), + ps.max_hp(), ps.max_sp(), ps.weight(), ps.max_weight(), ps.status_atk() + ps.equip_bonus("batk"), ps.weapon_atk() + ps.refine_atk(), + ps.hard_def(), ps.soft_def(), ps.hit(), ps.flee(), ps.crit_rate(), ps.aspd(), br]) + + static func fill(hud) -> bool: var body: VBoxContainer = hud.bodies["equip"] + var sig := signature() + if sig == _sig and body.get_child_count() > 0: + return true + _sig = sig if preview and is_instance_valid(preview) and preview.get_parent(): preview.get_parent().remove_child(preview) hud._clear(body)