forked from mtcontrib/minetest_hudbars
Big statbar icons, introduce new offset config
This commit is contained in:
parent
05f5ec0622
commit
3d74745aec
26
init.lua
26
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_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.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.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.bar_type = hb.load_setting("hudbars_bar_type", "string", "progress_bar", {"progress_bar", "statbar_classic", "statbar_modern"})
|
||||||
hb.settings.start_offset_left.y = hb.load_setting("hudbars_start_offset_left_y", "number", -86)
|
if hb.settings.bar_type == "progress_bar" then
|
||||||
hb.settings.start_offset_right.x = hb.load_setting("hudbars_start_offset_right_x", "number", 15)
|
hb.settings.start_offset_left.x = hb.load_setting("hudbars_start_offset_left_x", "number", -175)
|
||||||
hb.settings.start_offset_right.y = hb.load_setting("hudbars_start_offset_right_y", "number", -86)
|
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.vmargin = hb.load_setting("hudbars_vmargin", "number", 24)
|
||||||
hb.settings.tick = hb.load_setting("hudbars_tick", "number", 0.1)
|
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
|
-- Misc. settings
|
||||||
hb.settings.alignment_pattern = hb.load_setting("hudbars_alignment_pattern", "string", "zigzag", {"zigzag", "stack_up", "stack_down"})
|
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)
|
hb.settings.autohide_breath = hb.load_setting("hudbars_autohide_breath", "bool", true)
|
||||||
|
|
||||||
local sorting = minetest.setting_get("hudbars_sorting")
|
local sorting = minetest.setting_get("hudbars_sorting")
|
||||||
|
@ -222,14 +228,18 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
|
||||||
number = bgiconnumber,
|
number = bgiconnumber,
|
||||||
alignment = {x=-1,y=-1},
|
alignment = {x=-1,y=-1},
|
||||||
offset = { x = offset.x, y = offset.y },
|
offset = { x = offset.x, y = offset.y },
|
||||||
|
direction = 0,
|
||||||
|
size = {x=24, y=24},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local bar_image
|
local bar_image, bar_size
|
||||||
if hb.settings.bar_type == "progress_bar" then
|
if hb.settings.bar_type == "progress_bar" then
|
||||||
bar_image = textures.bar
|
bar_image = textures.bar
|
||||||
|
bar_size = nil
|
||||||
elseif hb.settings.bar_type == "statbar_classic" or hb.settings.bar_type == "statbar_modern" then
|
elseif hb.settings.bar_type == "statbar_classic" or hb.settings.bar_type == "statbar_modern" then
|
||||||
bar_image = textures.icon
|
bar_image = textures.icon
|
||||||
|
bar_size = {x=24, y=24}
|
||||||
end
|
end
|
||||||
ids.bar = player:hud_add({
|
ids.bar = player:hud_add({
|
||||||
hud_elem_type = "statbar",
|
hud_elem_type = "statbar",
|
||||||
|
@ -238,6 +248,8 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
|
||||||
number = barnumber,
|
number = barnumber,
|
||||||
alignment = {x=-1,y=-1},
|
alignment = {x=-1,y=-1},
|
||||||
offset = offset,
|
offset = offset,
|
||||||
|
direction = 0,
|
||||||
|
size = bar_size,
|
||||||
})
|
})
|
||||||
if hb.settings.bar_type == "progress_bar" then
|
if hb.settings.bar_type == "progress_bar" then
|
||||||
ids.text = player:hud_add({
|
ids.text = player:hud_add({
|
||||||
|
|
|
@ -77,17 +77,38 @@ hudbars_pos_right_y (Right HUD bar screen y position) float 1.0 0.0 1.0
|
||||||
|
|
||||||
# Precise x offset in pixels from the basic screen x position of the HUD bars.
|
# Precise x offset in pixels from the basic screen x position of the HUD bars.
|
||||||
# For the zig-zag alignment pattern, this is for the left HUD bars.
|
# For the zig-zag alignment pattern, this is for the left HUD bars.
|
||||||
|
# This setting is used for the progress bar HUD bar style.
|
||||||
hudbars_start_offset_left_x (Left HUD bar x offset) int -175
|
hudbars_start_offset_left_x (Left HUD bar x offset) int -175
|
||||||
# Precise y offset in pixels from the basic screen y position of the HUD bars.
|
# Precise y offset in pixels from the basic screen y position of the HUD bars.
|
||||||
# For the zig-zag alignment pattern, this is for the left HUD bars.
|
# For the zig-zag alignment pattern, this is for the left HUD bars.
|
||||||
|
# This setting is used for the progress bar HUD bar style.
|
||||||
hudbars_start_offset_left_y (Left HUD bar y offset) int -86
|
hudbars_start_offset_left_y (Left HUD bar y offset) int -86
|
||||||
# Precise x offset in pixels from the basic screen x position of the right HUD bars.
|
# Precise x offset in pixels from the basic screen x position of the right HUD bars.
|
||||||
# Only used for the zig-zag alignment pattern.
|
# Only used for the zig-zag alignment pattern.
|
||||||
|
# This setting is used for the progress bar HUD bar style.
|
||||||
hudbars_start_offset_right_x (Right HUD bar x offset) int 15
|
hudbars_start_offset_right_x (Right HUD bar x offset) int 15
|
||||||
# Precise y offset in pixels from the basic screen y position of the right HUD bars.
|
# Precise y offset in pixels from the basic screen y position of the right HUD bars.
|
||||||
# Only used for the zig-zag alignment pattern.
|
# Only used for the zig-zag alignment pattern.
|
||||||
|
# This setting is used for the progress bar HUD bar style.
|
||||||
hudbars_start_offset_right_y (Right HUD bar y offset) int -86
|
hudbars_start_offset_right_y (Right HUD bar y offset) int -86
|
||||||
|
|
||||||
|
# Precise x offset in pixels from the basic screen x position of the HUD statbars.
|
||||||
|
# For the zig-zag alignment pattern, this is for the left HUD statbars.
|
||||||
|
# This setting is used for the classic and modern statbar styles.
|
||||||
|
hudbars_start_statbar_offset_left_x (Left HUD statbar x offset) int -265
|
||||||
|
# Precise y offset in pixels from the basic screen y position of the HUD statbars.
|
||||||
|
# For the zig-zag alignment pattern, this is for the left HUD statbars.
|
||||||
|
# This setting is used for the classic and modern statbar styles.
|
||||||
|
hudbars_start_statbar_offset_left_y (Left HUD statbar y offset) int -88
|
||||||
|
# Precise x offset in pixels from the basic screen x position of the right HUD statbars.
|
||||||
|
# Only used for the zig-zag alignment pattern.
|
||||||
|
# This setting is used for the classic and modern statbar styles.
|
||||||
|
hudbars_start_statbar_offset_right_x (Right HUD statbar x offset) int 25
|
||||||
|
# Precise y offset in pixels from the basic screen y position of the right HUD statbars.
|
||||||
|
# Only used for the zig-zag alignment pattern.
|
||||||
|
# This setting is used for the classic and modern statbar styles.
|
||||||
|
hudbars_start_statbar_offset_right_y (Right HUD statbar y offset) int -88
|
||||||
|
|
||||||
# The vertical distance between two HUD bars, in pixels.
|
# The vertical distance between two HUD bars, in pixels.
|
||||||
hudbars_vmargin (Vertical distance between HUD bars) int 24 0
|
hudbars_vmargin (Vertical distance between HUD bars) int 24 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user