mirror of
https://github.com/minetest-mods/unified_inventory.git
synced 2024-08-20 05:14:09 +02:00
Fix item name position, also for hudbars
This commit is contained in:
parent
eb96c89b5d
commit
5a24e9f6fc
@ -2,24 +2,24 @@
|
|||||||
|
|
||||||
local item_names = {} -- [player_name] = { hud, dtime, itemname }
|
local item_names = {} -- [player_name] = { hud, dtime, itemname }
|
||||||
local dlimit = 3 -- HUD element will be hidden after this many seconds
|
local dlimit = 3 -- HUD element will be hidden after this many seconds
|
||||||
local air_hud_mod = minetest.get_modpath("4air")
|
|
||||||
local hud_mod = minetest.get_modpath("hud")
|
|
||||||
local hudbars_mod = minetest.get_modpath("hudbars")
|
local hudbars_mod = minetest.get_modpath("hudbars")
|
||||||
|
|
||||||
local function set_hud(player)
|
local function set_hud(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local off = {x=0, y=-70}
|
local off = {x=0, y=-65}
|
||||||
if air_hud_mod or hud_mod then
|
if hudbars_mod then
|
||||||
off.y = off.y - 20
|
-- Assume no alignment (2 per line)
|
||||||
elseif hudbars_mod then
|
off.y = off.y - math.ceil(hb.hudbars_count / 2) * 25
|
||||||
off.y = off.y + 13
|
else
|
||||||
|
off.y = off.y - 25
|
||||||
end
|
end
|
||||||
|
|
||||||
item_names[player_name] = {
|
item_names[player_name] = {
|
||||||
hud = player:hud_add({
|
hud = player:hud_add({
|
||||||
hud_elem_type = "text",
|
hud_elem_type = "text",
|
||||||
position = {x=0.5, y=1},
|
position = {x=0.5, y=1},
|
||||||
offset = off,
|
offset = off,
|
||||||
alignment = {x=0, y=0},
|
alignment = {x=0, y=-1},
|
||||||
number = 0xFFFFFF,
|
number = 0xFFFFFF,
|
||||||
text = "",
|
text = "",
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user