diff options
author | Wuzzy <almikes@aol.com> | 2015-02-12 03:15:00 +0100 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2015-02-12 03:15:00 +0100 |
commit | 8c17e9373b1afdef547f6153b2396f8b1bed77d3 (patch) | |
tree | dafb39154a3622e8e4c05bd71a69d6795f58f8c1 | |
parent | 20a13045f763f871af5601f1c809157d99472fd3 (diff) |
Fix start_hidden parameter
-rw-r--r-- | init.lua | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -55,12 +55,21 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta local ids = {} local state = {} local name = player:get_player_name() - local bgscale - if start_max == 0 then + local bgscale, iconscale, text, barnumber + if start_max == 0 or start_hidden then bgscale = { x=0, y=0 } else bgscale = { x=1, y=1 } end + if start_hidden then + iconscale = { x=0, y=0 } + barnumber = 0 + text = "" + else + iconscale = { x=1, y=1 } + barnumber = hb.value_to_barlength(start_value, start_max) + text = string.format(format_string, label, start_value, start_max) + end ids.bg = player:hud_add({ hud_elem_type = "image", position = pos, @@ -73,7 +82,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta ids.icon = player:hud_add({ hud_elem_type = "image", position = pos, - scale = { x = 1, y = 1 }, + scale = iconscale, text = textures.icon, alignment = {x=-1,y=1}, offset = { x = offset.x - 3, y = offset.y }, @@ -83,11 +92,10 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta hud_elem_type = "statbar", position = pos, text = textures.bar, - number = hb.value_to_barlength(start_value, start_max), + number = barnumber, alignment = {x=-1,y=-1}, offset = offset, }) - local text = string.format(format_string, label, start_value, start_max) ids.text = player:hud_add({ hud_elem_type = "text", position = pos, |