forked from mtcontrib/minetest_hudbars
Always send update when changing hide state
This fixes a problem in hbarmor not getting the correct hide state initially.
This commit is contained in:
parent
895fcae716
commit
915fab08e2
4
init.lua
4
init.lua
|
@ -384,7 +384,6 @@ function hb.hide_hudbar(player, identifier)
|
|||
local name = player:get_player_name()
|
||||
local hudtable = hb.get_hudtable(identifier)
|
||||
if hudtable == nil then return false end
|
||||
if(hudtable.hudstate[name].hidden == false) then
|
||||
if hb.settings.bar_type == "progress_bar" then
|
||||
if hudtable.hudids[name].icon ~= nil then
|
||||
player:hud_change(hudtable.hudids[name].icon, "scale", {x=0,y=0})
|
||||
|
@ -396,7 +395,6 @@ function hb.hide_hudbar(player, identifier)
|
|||
end
|
||||
player:hud_change(hudtable.hudids[name].bar, "number", 0)
|
||||
hudtable.hudstate[name].hidden = true
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -405,7 +403,6 @@ function hb.unhide_hudbar(player, identifier)
|
|||
local name = player:get_player_name()
|
||||
local hudtable = hb.get_hudtable(identifier)
|
||||
if hudtable == nil then return false end
|
||||
if(hudtable.hudstate[name].hidden) then
|
||||
local value = hudtable.hudstate[name].value
|
||||
local max = hudtable.hudstate[name].max
|
||||
if hb.settings.bar_type == "progress_bar" then
|
||||
|
@ -421,7 +418,6 @@ function hb.unhide_hudbar(player, identifier)
|
|||
end
|
||||
player:hud_change(hudtable.hudids[name].bar, "number", hb.value_to_barlength(value, max))
|
||||
hudtable.hudstate[name].hidden = false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user