Hotfix HUD

This commit is contained in:
Jean-Patrick Guerrero 2022-08-28 14:45:37 +02:00
parent 6b54dbc934
commit 646d16afd8

View File

@ -116,25 +116,27 @@ core.register_globalstep(function(dt)
data.timer = (data.timer or 0) + dt data.timer = (data.timer or 0) + dt
local wielditem = player:get_wielded_item() local wieldidx = player:get_wield_index()
local wieldname = wielditem:get_name()
if wieldname == data.old_wielditem then if wieldidx == data.old_wieldidx then
if data.timer >= i3.settings.wielditem_fade_after then if data.timer >= i3.settings.wielditem_fade_after then
return reset() return reset()
end end
return return
else
data.timer = 0
end end
data.old_wielditem = wieldname data.old_wieldidx = wieldidx
local wielditem = player:get_wielded_item()
local meta = wielditem:get_meta() local meta = wielditem:get_meta()
local meta_desc = meta:get_string"short_description" local meta_desc = meta:get_string"short_description"
meta_desc = meta_desc:gsub("\27", "") meta_desc = meta_desc:gsub("\27", "")
meta_desc = core.strip_colors(meta_desc) meta_desc = core.strip_colors(meta_desc)
local desc = meta_desc ~= "" and meta_desc or wielditem:get_short_description() local desc = meta_desc ~= "" and meta_desc or wielditem:get_short_description()
player:hud_change(data.hud.wielditem, "text", desc:trim()) player:hud_change(data.hud.wielditem, "text", desc:trim())
end end
end) end)