mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-20 01:51:06 +01:00
Support dynamic achievement image sizes
This commit is contained in:
parent
06701010ec
commit
e840fcbe5e
1 changed files with 10 additions and 4 deletions
|
@ -323,14 +323,20 @@ function awards.unlock(name, award)
|
||||||
offset = {x = 30, y = 100},
|
offset = {x = 30, y = 100},
|
||||||
alignment = {x = 0, y = -1}
|
alignment = {x = 0, y = -1}
|
||||||
})
|
})
|
||||||
|
--[[ 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.
|
||||||
|
Yes, it's a hack, but it works for all texture sizes and is needed because the image
|
||||||
|
type does NOT allow us a simple scaling. ]]
|
||||||
local four = player:hud_add({
|
local four = player:hud_add({
|
||||||
hud_elem_type = "image",
|
hud_elem_type = "statbar",
|
||||||
name = "award_icon",
|
name = "award_icon",
|
||||||
scale = {x = 4, y = 4},
|
size = {x=64, y = 64},
|
||||||
|
number = 2,
|
||||||
text = icon,
|
text = icon,
|
||||||
position = {x = 0.5, y = 0},
|
position = {x = 0.5, y = 0},
|
||||||
offset = {x = -81.5, y = 126},
|
offset = {x = -110, y = 62},
|
||||||
alignment = {x = 0, y = -1}
|
alignment = {x = 0, y = 0},
|
||||||
|
direction = 0,
|
||||||
})
|
})
|
||||||
minetest.after(3, function()
|
minetest.after(3, function()
|
||||||
player:hud_remove(one)
|
player:hud_remove(one)
|
||||||
|
|
Loading…
Reference in a new issue