1
0
Fork 0

Merge pull request 'Fix exp bar scaling issue with non 16x textures' (#2755) from talamh/MineClone2:expbar_fix into master

Reviewed-on: MineClone2/MineClone2#2755
Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
cora 2022-10-12 01:41:23 +00:00
commit 96a6cd1b9b
1 changed files with 4 additions and 3 deletions

View File

@ -181,7 +181,7 @@ function mcl_experience.setup_hud(player)
hud_elem_type = "image", hud_elem_type = "image",
position = {x = 0.5, y = 1}, position = {x = 0.5, y = 1},
offset = {x = (-9 * 28) - 3, y = -(48 + 24 + 16 - 5)}, offset = {x = (-9 * 28) - 3, y = -(48 + 24 + 16 - 5)},
scale = {x = 2.8, y = 3.0}, scale = {x = 0.35, y = 0.375},
alignment = {x = 1, y = 1}, alignment = {x = 1, y = 1},
z_index = 11, z_index = 11,
}) })
@ -206,9 +206,10 @@ function mcl_experience.update(player)
if not hud_bars[player] then if not hud_bars[player] then
mcl_experience.setup_hud(player) mcl_experience.setup_hud(player)
end end
player:hud_change(hud_bars[player], "text", "mcl_experience_bar_background.png^[lowpart:"
player:hud_change(hud_bars[player], "text", "(mcl_experience_bar_background.png^[lowpart:"
.. math.floor(math.floor(xp_to_bar(xp, cache.level) * 18) / 18 * 100) .. math.floor(math.floor(xp_to_bar(xp, cache.level) * 18) / 18 * 100)
.. ":mcl_experience_bar.png^[transformR270" .. ":mcl_experience_bar.png)^[resize:40x1456^[transformR270"
) )
if cache.level == 0 then if cache.level == 0 then