mirror of
https://github.com/minetest-mods/i3.git
synced 2024-12-26 02:40:38 +01:00
Minor cleaning
This commit is contained in:
parent
1560d59d4a
commit
734b09b69f
14
src/hud.lua
14
src/hud.lua
@ -105,28 +105,22 @@ core.register_globalstep(function(dt)
|
|||||||
local data = i3.data[name]
|
local data = i3.data[name]
|
||||||
if not data then return end
|
if not data then return end
|
||||||
|
|
||||||
local function reset()
|
|
||||||
player:hud_change(data.hud.wielditem, "text", "")
|
|
||||||
data.timer = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
if not data.wielditem_hud then
|
if not data.wielditem_hud then
|
||||||
return reset()
|
player:hud_change(data.hud.wielditem, "text", "")
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
data.timer = (data.timer or 0) + dt
|
data.timer = (data.timer or 0) + dt
|
||||||
|
|
||||||
local wieldidx = player:get_wield_index()
|
local wieldidx = player:get_wield_index()
|
||||||
|
|
||||||
if wieldidx == data.old_wieldidx 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()
|
player:hud_change(data.hud.wielditem, "text", "")
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
else
|
|
||||||
data.timer = 0
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
data.timer = 0
|
||||||
data.old_wieldidx = wieldidx
|
data.old_wieldidx = wieldidx
|
||||||
|
|
||||||
local wielditem = player:get_wielded_item()
|
local wielditem = player:get_wielded_item()
|
||||||
|
Loading…
Reference in New Issue
Block a user