Compare commits

...

16 Commits

Author SHA1 Message Date
6e2173c6e3 Merge remote-tracking branch 'upstream/master' 2022-08-26 15:02:26 +02:00
Wuzzy
dd2a9a008d Add mailmap for Wuzzy 2022-08-01 13:57:41 +02:00
a7d0774ad0 Merge remote-tracking branch 'upstream/master' 2021-07-16 23:40:29 +02:00
Wuzzy
812b2538ff Version 2.3.3 2021-07-08 15:43:14 +02:00
Wuzzy
906f7876f7 Version 2.3.2 2021-07-08 15:42:11 +02:00
Wuzzy
a44de6230b Fix massive hud_change spam (hide/unhide) 2021-07-08 15:34:50 +02:00
26a36dde55 Merge remote-tracking branch 'upstream/master' 2020-07-17 22:49:18 +02:00
Wuzzy
0684bac45b Version 2.3.1 2020-07-11 03:41:09 +02:00
Wuzzy
183d727635 Revert "12×12 textures, compress textures"
This reverts commit 746945dd0f.
2020-07-11 03:38:16 +02:00
Wuzzy
f1001432eb Revert "Tweak breath icons"
This reverts commit 5d65623d90.
2020-07-11 03:38:14 +02:00
Wuzzy
a41453964a Version 2.3.0 2020-07-11 03:28:39 +02:00
Wuzzy
5d65623d90 Tweak breath icons 2020-07-11 03:28:01 +02:00
Wuzzy
f6d539249e More bg icon cleanup 2020-07-11 03:25:35 +02:00
Wuzzy
746945dd0f 12×12 textures, compress textures 2020-07-11 03:09:14 +02:00
Wuzzy
37eff8b2d2 Fix breath bar that was broken by MT 5.3.0 2020-07-11 02:59:12 +02:00
Wuzzy
844fff43de Use MT native support for "background icons" 2020-07-11 02:57:23 +02:00
3 changed files with 15 additions and 21 deletions

2
.mailmap Normal file
View File

@ -0,0 +1,2 @@
Wuzzy <Wuzzy@disroot.org> <Wuzzy2@mail.ru>
Wuzzy <Wuzzy@disroot.org> <almikes@aol.com>

View File

@ -11,7 +11,8 @@ this mod will place them accordingly.
position should be displayed correctly on every screen size.
## Current version
The current version is 2.2.2.
The current version is 2.3.3.
It works for Minetest 5.3.0.
This software uses [semantic versioning](http://semver.org), as defined by version 2.0.0 of the SemVer
standard.

View File

@ -213,22 +213,8 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
z_index = 1,
})
end
elseif hb.settings.bar_type == "statbar_modern" then
if textures.bgicon ~= nil then
ids.bg = player:hud_add({
hud_elem_type = "statbar",
position = pos,
text = textures.bgicon,
number = bgiconnumber,
alignment = {x=-1,y=-1},
offset = { x = offset.x, y = offset.y },
direction = 0,
size = {x=24, y=24},
z_index = 0,
})
end
end
local bar_image, bar_size
local bar_image, bgicon, bar_size
if hb.settings.bar_type == "progress_bar" then
bar_image = textures.bar
-- NOTE: Intentionally set to nil. For some reason, on some systems,
@ -240,13 +226,16 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
bar_size = nil
elseif hb.settings.bar_type == "statbar_classic" or hb.settings.bar_type == "statbar_modern" then
bar_image = textures.icon
bgicon = textures.bgicon
bar_size = {x=24, y=24}
end
ids.bar = player:hud_add({
hud_elem_type = "statbar",
position = pos,
text = bar_image,
text2 = bgicon,
number = barnumber,
item = bgiconnumber,
alignment = {x=-1,y=-1},
offset = offset,
direction = 0,
@ -415,16 +404,16 @@ function hb.hide_hudbar(player, identifier)
local name = player:get_player_name()
local hudtable = hb.get_hudtable(identifier)
if hudtable == nil then return false end
if hudtable.hudstate[name].hidden == true then return true end
if hb.settings.bar_type == "progress_bar" then
if hudtable.hudids[name].icon ~= nil then
player:hud_change(hudtable.hudids[name].icon, "scale", {x=0,y=0})
end
player:hud_change(hudtable.hudids[name].bg, "scale", {x=0,y=0})
player:hud_change(hudtable.hudids[name].text, "text", "")
elseif hb.settings.bar_type == "statbar_modern" then
player:hud_change(hudtable.hudids[name].bg, "number", 0)
end
player:hud_change(hudtable.hudids[name].bar, "number", 0)
player:hud_change(hudtable.hudids[name].bar, "item", 0)
hudtable.hudstate[name].hidden = true
return true
end
@ -434,6 +423,7 @@ function hb.unhide_hudbar(player, identifier)
local name = player:get_player_name()
local hudtable = hb.get_hudtable(identifier)
if hudtable == nil then return false end
if hudtable.hudstate[name].hidden == false then return true end
local value = hudtable.hudstate[name].value
local max = hudtable.hudstate[name].max
if hb.settings.bar_type == "progress_bar" then
@ -445,9 +435,10 @@ function hb.unhide_hudbar(player, identifier)
end
player:hud_change(hudtable.hudids[name].text, "text", make_label(hudtable.format_string, hudtable.format_string_config, hudtable.label, value, max))
elseif hb.settings.bar_type == "statbar_modern" then
player:hud_change(hudtable.hudids[name].bg, "number", hb.settings.statbar_length)
player:hud_change(hudtable.hudids[name].bar, "scale", {x=1,y=1})
end
player:hud_change(hudtable.hudids[name].bar, "number", hb.value_to_barlength(value, max))
player:hud_change(hudtable.hudids[name].bar, "item", hb.value_to_barlength(max, max))
hudtable.hudstate[name].hidden = false
return true
end
@ -503,7 +494,7 @@ local function custom_hud(player)
local breath_max = player:get_properties().breath_max
local hide_breath
if breath >= breath_max and hb.settings.autohide_breath == true then hide_breath = true else hide_breath = false end
hb.init_hudbar(player, "breath", math.min(breath, breath_max-1), breath_max-1, hide_breath or hide)
hb.init_hudbar(player, "breath", math.min(breath, breath_max), breath_max, hide_breath or hide)
end
end
@ -527,7 +518,7 @@ local function update_hud(player)
hb.hide_hudbar(player, "breath")
else
hb.unhide_hudbar(player, "breath")
hb.change_hudbar(player, "breath", math.min(breath, breath_max-1), breath_max-1)
hb.change_hudbar(player, "breath", math.min(breath, breath_max), breath_max)
end
--health
update_health(player)