forked from MineClone5/MineClone5
Add z_index to HUD elements
This commit is contained in:
parent
17f611567c
commit
f27615d77e
|
@ -578,6 +578,7 @@ if c("totem") then
|
||||||
position = { x=0.5, y=1 },
|
position = { x=0.5, y=1 },
|
||||||
scale = { x=17, y=17 },
|
scale = { x=17, y=17 },
|
||||||
offset = { x=0, y=-178 },
|
offset = { x=0, y=-178 },
|
||||||
|
z_index = 10,
|
||||||
})
|
})
|
||||||
minetest.after(3, function(name)
|
minetest.after(3, function(name)
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
|
|
|
@ -297,7 +297,8 @@ function awards.unlock(name, award)
|
||||||
text = background,
|
text = background,
|
||||||
position = {x = 0.5, y = 0},
|
position = {x = 0.5, y = 0},
|
||||||
offset = {x = 0, y = 138},
|
offset = {x = 0, y = 138},
|
||||||
alignment = {x = 0, y = -1}
|
alignment = {x = 0, y = -1},
|
||||||
|
z_index = 11,
|
||||||
})
|
})
|
||||||
local hud_announce
|
local hud_announce
|
||||||
if awdef.secret == true then
|
if awdef.secret == true then
|
||||||
|
@ -313,7 +314,8 @@ function awards.unlock(name, award)
|
||||||
text = hud_announce,
|
text = hud_announce,
|
||||||
position = {x = 0.5, y = 0},
|
position = {x = 0.5, y = 0},
|
||||||
offset = {x = 0, y = 40},
|
offset = {x = 0, y = 40},
|
||||||
alignment = {x = 0, y = -1}
|
alignment = {x = 0, y = -1},
|
||||||
|
z_index = 12,
|
||||||
})
|
})
|
||||||
local three = player:hud_add({
|
local three = player:hud_add({
|
||||||
hud_elem_type = "text",
|
hud_elem_type = "text",
|
||||||
|
@ -323,7 +325,8 @@ function awards.unlock(name, award)
|
||||||
text = title,
|
text = title,
|
||||||
position = {x = 0.5, y = 0},
|
position = {x = 0.5, y = 0},
|
||||||
offset = {x = 30, y = 100},
|
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
|
--[[ 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.
|
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},
|
offset = {x = -110, y = 62},
|
||||||
alignment = {x = 0, y = 0},
|
alignment = {x = 0, y = 0},
|
||||||
direction = 0,
|
direction = 0,
|
||||||
|
z_index = 12,
|
||||||
})
|
})
|
||||||
minetest.after(3, function(name)
|
minetest.after(3, function(name)
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
|
|
|
@ -200,6 +200,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
|
||||||
text = "hudbars_bar_background.png",
|
text = "hudbars_bar_background.png",
|
||||||
alignment = {x=1,y=1},
|
alignment = {x=1,y=1},
|
||||||
offset = { x = offset.x - 1, y = offset.y - 1 },
|
offset = { x = offset.x - 1, y = offset.y - 1 },
|
||||||
|
z_index = 0,
|
||||||
})
|
})
|
||||||
if textures.icon ~= nil then
|
if textures.icon ~= nil then
|
||||||
ids.icon = player:hud_add({
|
ids.icon = player:hud_add({
|
||||||
|
@ -209,6 +210,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
|
||||||
text = textures.icon,
|
text = textures.icon,
|
||||||
alignment = {x=-1,y=1},
|
alignment = {x=-1,y=1},
|
||||||
offset = { x = offset.x - 3, y = offset.y },
|
offset = { x = offset.x - 3, y = offset.y },
|
||||||
|
z_index = 1,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
elseif hb.settings.bar_type == "statbar_modern" then
|
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 },
|
offset = { x = offset.x, y = offset.y },
|
||||||
direction = 0,
|
direction = 0,
|
||||||
size = {x=24, y=24},
|
size = {x=24, y=24},
|
||||||
|
z_index = 0,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -248,6 +251,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
|
||||||
offset = offset,
|
offset = offset,
|
||||||
direction = 0,
|
direction = 0,
|
||||||
size = bar_size,
|
size = bar_size,
|
||||||
|
z_index = 1,
|
||||||
})
|
})
|
||||||
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({
|
||||||
|
@ -258,6 +262,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
|
||||||
number = text_color,
|
number = text_color,
|
||||||
direction = 0,
|
direction = 0,
|
||||||
offset = { x = offset.x + 2, y = offset.y - 1},
|
offset = { x = offset.x + 2, y = offset.y - 1},
|
||||||
|
z_index = 2,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
-- Do not forget to update hb.get_hudbar_state if you add new fields to the state table
|
-- Do not forget to update hb.get_hudbar_state if you add new fields to the state table
|
||||||
|
|
|
@ -42,6 +42,7 @@ local function set_hud(player)
|
||||||
alignment = {x=0, y=0},
|
alignment = {x=0, y=0},
|
||||||
number = 0xFFFFFF ,
|
number = 0xFFFFFF ,
|
||||||
text = "",
|
text = "",
|
||||||
|
z_index = 10,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ local function now_playing(player, track_id)
|
||||||
size = { x=100, y=100},
|
size = { x=100, y=100},
|
||||||
number = 0x55FFFF,
|
number = 0x55FFFF,
|
||||||
text = text,
|
text = text,
|
||||||
|
z_index = 10,
|
||||||
})
|
})
|
||||||
active_huds[playername] = id
|
active_huds[playername] = id
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue