added wuzzy's changes
parent
4d90bda5ee
commit
c2c10e3821
|
@ -67,7 +67,7 @@ hb.settings.start_offset_left.y = hb.load_setting("hudbars_start_offset_left_y",
|
|||
hb.settings.start_offset_right.x = hb.load_setting("hudbars_start_offset_right_x", "number", (15 * gui_scale))
|
||||
hb.settings.start_offset_right.y = hb.load_setting("hudbars_start_offset_right_y", "number", -86)
|
||||
|
||||
hb.settings.vmargin = hb.load_setting("hudbars_tick", "number", 24 * gui_scale)
|
||||
hb.settings.vmargin = hb.load_setting("hudbars_vmargin", "number", 24 * gui_scale)
|
||||
hb.settings.tick = hb.load_setting("hudbars_tick", "number", 1) -- was 0.1
|
||||
|
||||
-- experimental setting: Changing this setting is not officially supported, do NOT rely on it!
|
||||
|
@ -377,7 +377,8 @@ function hb.init_hudbar(player, identifier, start_value, start_max, start_hidden
|
|||
hb.hudtables[identifier].add_all(player, hudtable, start_value, start_max, start_hidden)
|
||||
end
|
||||
|
||||
function hb.change_hudbar(player, identifier, new_value, new_max_value)
|
||||
function hb.change_hudbar(player, identifier, new_value, new_max_value,
|
||||
new_icon, new_bgicon, new_bar, new_label, new_text_color)
|
||||
|
||||
if new_value == nil
|
||||
and new_max_value == nil then
|
||||
|
@ -418,6 +419,42 @@ function hb.change_hudbar(player, identifier, new_value, new_max_value)
|
|||
new_max_value = hudtable.hudstate[name].max
|
||||
end
|
||||
|
||||
if hb.settings.bar_type == "progress_bar" then -- NEW block added in 1.40
|
||||
|
||||
if new_icon ~= nil and hudtable.hudids[name].icon ~= nil then
|
||||
player:hud_change(hudtable.hudids[name].icon, "text", new_icon)
|
||||
end
|
||||
|
||||
if new_bgicon ~= nil and hudtable.hudids[name].bgicon ~= nil then
|
||||
player:hud_change(hudtable.hudids[name].bgicon, "text", new_bgicon)
|
||||
end
|
||||
|
||||
if new_bar ~= nil then
|
||||
player:hud_change(hudtable.hudids[name].bar , "text", new_bar)
|
||||
end
|
||||
|
||||
if new_label ~= nil then
|
||||
|
||||
hudtable.label = new_label
|
||||
|
||||
local new_text = string.format(hudtable.format_string, new_label, hudtable.hudstate[name].value, hudtable.hudstate[name].max)
|
||||
|
||||
player:hud_change(hudtable.hudids[name].text, "text", new_text)
|
||||
end
|
||||
|
||||
if new_text_color ~= nil then
|
||||
player:hud_change(hudtable.hudids[name].text, "number", new_text_color)
|
||||
end
|
||||
else
|
||||
if new_icon ~= nil and hudtable.hudids[name].bar ~= nil then
|
||||
player:hud_change(hudtable.hudids[name].bar, "text", new_icon)
|
||||
end
|
||||
|
||||
if new_bgicon ~= nil and hudtable.hudids[name].bg ~= nil then
|
||||
player:hud_change(hudtable.hudids[name].bg, "text", new_bgicon)
|
||||
end
|
||||
end
|
||||
|
||||
local main_error_text =
|
||||
"[hudbars] Bad call to hb.change_hudbar, identifier: “"
|
||||
..tostring(identifier).."”, player name: “"..name.."”. "
|
||||
|
|
Loading…
Reference in New Issue