Add z_index to HUD elements

This commit is contained in:
Wuzzy 2020-04-07 13:03:10 +02:00
parent 17f611567c
commit f27615d77e
5 changed files with 15 additions and 3 deletions

View File

@ -578,6 +578,7 @@ if c("totem") then
position = { x=0.5, y=1 },
scale = { x=17, y=17 },
offset = { x=0, y=-178 },
z_index = 10,
})
minetest.after(3, function(name)
local player = minetest.get_player_by_name(name)

View File

@ -297,7 +297,8 @@ function awards.unlock(name, award)
text = background,
position = {x = 0.5, y = 0},
offset = {x = 0, y = 138},
alignment = {x = 0, y = -1}
alignment = {x = 0, y = -1},
z_index = 11,
})
local hud_announce
if awdef.secret == true then
@ -313,7 +314,8 @@ function awards.unlock(name, award)
text = hud_announce,
position = {x = 0.5, y = 0},
offset = {x = 0, y = 40},
alignment = {x = 0, y = -1}
alignment = {x = 0, y = -1},
z_index = 12,
})
local three = player:hud_add({
hud_elem_type = "text",
@ -323,7 +325,8 @@ function awards.unlock(name, award)
text = title,
position = {x = 0.5, y = 0},
offset = {x = 30, y = 100},
alignment = {x = 0, y = -1}
alignment = {x = 0, y = -1},
z_index = 12,
})
--[[ We use a statbar instead of image here because statbar allows us to scale the image
properly. Note that number is 2, thus leading to a single full image.
@ -339,6 +342,7 @@ function awards.unlock(name, award)
offset = {x = -110, y = 62},
alignment = {x = 0, y = 0},
direction = 0,
z_index = 12,
})
minetest.after(3, function(name)
local player = minetest.get_player_by_name(name)

View File

@ -200,6 +200,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
text = "hudbars_bar_background.png",
alignment = {x=1,y=1},
offset = { x = offset.x - 1, y = offset.y - 1 },
z_index = 0,
})
if textures.icon ~= nil then
ids.icon = player:hud_add({
@ -209,6 +210,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
text = textures.icon,
alignment = {x=-1,y=1},
offset = { x = offset.x - 3, y = offset.y },
z_index = 1,
})
end
elseif hb.settings.bar_type == "statbar_modern" then
@ -222,6 +224,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
offset = { x = offset.x, y = offset.y },
direction = 0,
size = {x=24, y=24},
z_index = 0,
})
end
end
@ -248,6 +251,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
offset = offset,
direction = 0,
size = bar_size,
z_index = 1,
})
if hb.settings.bar_type == "progress_bar" then
ids.text = player:hud_add({
@ -258,6 +262,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
number = text_color,
direction = 0,
offset = { x = offset.x + 2, y = offset.y - 1},
z_index = 2,
})
end
-- Do not forget to update hb.get_hudbar_state if you add new fields to the state table

View File

@ -42,6 +42,7 @@ local function set_hud(player)
alignment = {x=0, y=0},
number = 0xFFFFFF ,
text = "",
z_index = 10,
})
end

View File

@ -70,6 +70,7 @@ local function now_playing(player, track_id)
size = { x=100, y=100},
number = 0x55FFFF,
text = text,
z_index = 10,
})
active_huds[playername] = id
end