From 3d74745aec4d95d80090aa0730a7a1c1c4eab32f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 2 Dec 2016 21:40:46 +0100 Subject: [PATCH] Big statbar icons, introduce new offset config --- init.lua | 26 +++++++++++++++++++------- settingtypes.txt | 21 +++++++++++++++++++++ 2 files changed, 40 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({ diff --git a/settingtypes.txt b/settingtypes.txt index 5779063..deffd61 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -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. # 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 # 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. +# This setting is used for the progress bar HUD bar style. 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. # 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 # Precise y offset in pixels from the basic screen y position of the right HUD bars. # 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 +# 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. hudbars_vmargin (Vertical distance between HUD bars) int 24 0