diff --git a/Bagnon/components/item.lua b/Bagnon/components/item.lua index 9bded9a..7016d31 100644 --- a/Bagnon/components/item.lua +++ b/Bagnon/components/item.lua @@ -286,17 +286,26 @@ function ItemSlot:Update() if not self:IsVisible() then return end local texture, count, locked, quality, readable, lootable, link = self:GetItemSlotInfo() + local now = GetTime() - -- If the slot was occupied at our last good draw and the live read just - -- returned nil within the grace window, keep the previous draw and queue - -- a single re-check. No retry storm. - if (not link) and self.hasItem and (self.lastGoodTime or 0) + GRACE_WINDOW > GetTime() then - scheduleVerify(self) - return - end - - if link then - self.lastGoodTime = GetTime() + -- Any nil read might be a lag race (server hasn't delivered item data + -- yet). Arm a single re-check so a late arrival redraws correctly. The + -- flag stays armed until we see a valid link, so a genuinely empty slot + -- doesn't keep re-scheduling. + if not link then + if not self.verifyArmed then + self.verifyArmed = true + scheduleVerify(self) + end + -- If we had a confirmed item recently, also suppress the empty draw + -- so the slot doesn't flash. After the grace window we let the empty + -- through (genuine moves still resolve at ~0.5s). + if self.hasItem and (self.lastGoodTime or 0) + GRACE_WINDOW > now then + return + end + else + self.lastGoodTime = now + self.verifyArmed = nil end self:SetItem(link)