1
0
Fork 0

Support dynamic achievement image sizes

This commit is contained in:
Wuzzy 2017-03-04 00:56:56 +01:00
parent 06701010ec
commit e840fcbe5e
1 changed files with 10 additions and 4 deletions

View File

@ -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)