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:
Wuzzy 2019-04-01 12:16:36 +02:00
parent 895fcae716
commit 915fab08e2

View File

@ -384,7 +384,6 @@ function hb.hide_hudbar(player, identifier)
local name = player:get_player_name() local name = player:get_player_name()
local hudtable = hb.get_hudtable(identifier) local hudtable = hb.get_hudtable(identifier)
if hudtable == nil then return false end if hudtable == nil then return false end
if(hudtable.hudstate[name].hidden == false) then
if hb.settings.bar_type == "progress_bar" then if hb.settings.bar_type == "progress_bar" then
if hudtable.hudids[name].icon ~= nil then if hudtable.hudids[name].icon ~= nil then
player:hud_change(hudtable.hudids[name].icon, "scale", {x=0,y=0}) player:hud_change(hudtable.hudids[name].icon, "scale", {x=0,y=0})
@ -396,7 +395,6 @@ function hb.hide_hudbar(player, identifier)
end end
player:hud_change(hudtable.hudids[name].bar, "number", 0) player:hud_change(hudtable.hudids[name].bar, "number", 0)
hudtable.hudstate[name].hidden = true hudtable.hudstate[name].hidden = true
end
return true return true
end end
@ -405,7 +403,6 @@ function hb.unhide_hudbar(player, identifier)
local name = player:get_player_name() local name = player:get_player_name()
local hudtable = hb.get_hudtable(identifier) local hudtable = hb.get_hudtable(identifier)
if hudtable == nil then return false end if hudtable == nil then return false end
if(hudtable.hudstate[name].hidden) then
local value = hudtable.hudstate[name].value local value = hudtable.hudstate[name].value
local max = hudtable.hudstate[name].max local max = hudtable.hudstate[name].max
if hb.settings.bar_type == "progress_bar" then if hb.settings.bar_type == "progress_bar" then
@ -421,7 +418,6 @@ function hb.unhide_hudbar(player, identifier)
end end
player:hud_change(hudtable.hudids[name].bar, "number", hb.value_to_barlength(value, max)) player:hud_change(hudtable.hudids[name].bar, "number", hb.value_to_barlength(value, max))
hudtable.hudstate[name].hidden = false hudtable.hudstate[name].hidden = false
end
return true return true
end end