diff options
author | Wuzzy <almikes@aol.com> | 2015-02-04 20:36:27 +0100 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2015-02-04 20:36:27 +0100 |
commit | 017b304396e139b85105c4133e99c9cadd6d8b41 (patch) | |
tree | a73d109a7405fc227f95f474938705e44586d211 | |
parent | d67a97011ba0c4511af926105d11273685743fec (diff) |
Allow freely chosen texture names for custom bars
-rw-r--r-- | init.lua | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -57,7 +57,7 @@ function hud.value_to_barlength(value, max) return math.ceil((value/max) * HUD_BARLENGTH) end -function hud.register_hudbar(identifier, text_color, label, use_icon, default_start_value, default_start_max, start_hide, format_string) +function hud.register_hudbar(identifier, text_color, label, textures, default_start_value, default_start_max, start_hide, format_string) local hudtable = {} local pos, offset if hud.hudbars_count % 2 == 0 then @@ -91,12 +91,12 @@ function hud.register_hudbar(identifier, text_color, label, use_icon, default_st alignment = {x=1,y=1}, offset = { x = offset.x - 1, y = offset.y - 1 }, }) - if use_icon then + if textures.icon ~= nil then ids.icon = player:hud_add({ hud_elem_type = "image", position = pos, scale = { x = 1, y = 1 }, - text = "hudbars_icon_"..identifier..".png", + text = textures.icon, alignment = {x=-1,y=1}, offset = { x = offset.x - 3, y = offset.y }, }) @@ -104,7 +104,7 @@ function hud.register_hudbar(identifier, text_color, label, use_icon, default_st ids.bar = player:hud_add({ hud_elem_type = "statbar", position = pos, - text = "hudbars_bar_"..identifier..".png", + text = textures.bar, number = hud.value_to_barlength(start_value, start_max), alignment = {x=-1,y=-1}, offset = offset, |