summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua26
1 files changed, 19 insertions, 7 deletions
diff --git a/init.lua b/init.lua
index 7030084..b06a85b 100644
--- a/init.lua
+++ b/init.lua
@@ -61,11 +61,18 @@ hb.settings.pos_left.x = hb.load_setting("hudbars_pos_left_x", "number", 0.5)
hb.settings.pos_left.y = hb.load_setting("hudbars_pos_left_y", "number", 1)
hb.settings.pos_right.x = hb.load_setting("hudbars_pos_right_x", "number", 0.5)
hb.settings.pos_right.y = hb.load_setting("hudbars_pos_right_y", "number", 1)
-hb.settings.start_offset_left.x = hb.load_setting("hudbars_start_offset_left_x", "number", -175)
-hb.settings.start_offset_left.y = hb.load_setting("hudbars_start_offset_left_y", "number", -86)
-hb.settings.start_offset_right.x = hb.load_setting("hudbars_start_offset_right_x", "number", 15)
-hb.settings.start_offset_right.y = hb.load_setting("hudbars_start_offset_right_y", "number", -86)
-
+hb.settings.bar_type = hb.load_setting("hudbars_bar_type", "string", "progress_bar", {"progress_bar", "statbar_classic", "statbar_modern"})
+if hb.settings.bar_type == "progress_bar" then
+ hb.settings.start_offset_left.x = hb.load_setting("hudbars_start_offset_left_x", "number", -175)
+ hb.settings.start_offset_left.y = hb.load_setting("hudbars_start_offset_left_y", "number", -86)
+ hb.settings.start_offset_right.x = hb.load_setting("hudbars_start_offset_right_x", "number", 15)
+ hb.settings.start_offset_right.y = hb.load_setting("hudbars_start_offset_right_y", "number", -86)
+else
+ hb.settings.start_offset_left.x = hb.load_setting("hudbars_start_statbar_offset_left_x", "number", -265)
+ hb.settings.start_offset_left.y = hb.load_setting("hudbars_start_statbar_offset_left_y", "number", -88)
+ hb.settings.start_offset_right.x = hb.load_setting("hudbars_start_statbar_offset_right_x", "number", 25)
+ hb.settings.start_offset_right.y = hb.load_setting("hudbars_start_statbar_offset_right_y", "number", -88)
+end
hb.settings.vmargin = hb.load_setting("hudbars_vmargin", "number", 24)
hb.settings.tick = hb.load_setting("hudbars_tick", "number", 0.1)
@@ -74,7 +81,6 @@ hb.settings.forceload_default_hudbars = hb.load_setting("hudbars_forceload_defau
-- Misc. settings
hb.settings.alignment_pattern = hb.load_setting("hudbars_alignment_pattern", "string", "zigzag", {"zigzag", "stack_up", "stack_down"})
-hb.settings.bar_type = hb.load_setting("hudbars_bar_type", "string", "progress_bar", {"progress_bar", "statbar_classic", "statbar_modern"})
hb.settings.autohide_breath = hb.load_setting("hudbars_autohide_breath", "bool", true)
local sorting = minetest.setting_get("hudbars_sorting")
@@ -222,14 +228,18 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
number = bgiconnumber,
alignment = {x=-1,y=-1},
offset = { x = offset.x, y = offset.y },
+ direction = 0,
+ size = {x=24, y=24},
})
end
end
- local bar_image
+ local bar_image, bar_size
if hb.settings.bar_type == "progress_bar" then
bar_image = textures.bar
+ bar_size = nil
elseif hb.settings.bar_type == "statbar_classic" or hb.settings.bar_type == "statbar_modern" then
bar_image = textures.icon
+ bar_size = {x=24, y=24}
end
ids.bar = player:hud_add({
hud_elem_type = "statbar",
@@ -238,6 +248,8 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
number = barnumber,
alignment = {x=-1,y=-1},
offset = offset,
+ direction = 0,
+ size = bar_size,
})
if hb.settings.bar_type == "progress_bar" then
ids.text = player:hud_add({