Fine-tune HUD

This commit is contained in:
Jean-Patrick Guerrero 2019-08-30 17:39:03 +02:00
parent c468ab22fd
commit 8b86dfc857

@ -1223,15 +1223,15 @@ if progressive_mode then
data.hud = { data.hud = {
bg = player:hud_add({ bg = player:hud_add({
hud_elem_type = "image", hud_elem_type = "image",
position = {x = 0.8, y = 1}, position = {x = 0.78, y = 1},
alignment = {x = 1, y = 1}, alignment = {x = 1, y = 1},
scale = {x = 320, y = 112}, scale = {x = 370, y = 112},
text = "craftguide_bg.png", text = "craftguide_bg.png",
}), }),
book = player:hud_add({ book = player:hud_add({
hud_elem_type = "image", hud_elem_type = "image",
position = {x = 0.81, y = 1.02}, position = {x = 0.79, y = 1.02},
alignment = {x = 1, y = 1}, alignment = {x = 1, y = 1},
scale = {x = 4, y = 4}, scale = {x = 4, y = 4},
text = "craftguide_book.png", text = "craftguide_book.png",
@ -1239,7 +1239,7 @@ if progressive_mode then
text = player:hud_add({ text = player:hud_add({
hud_elem_type = "text", hud_elem_type = "text",
position = {x = 0.85, y = 1.04}, position = {x = 0.84, y = 1.04},
alignment = {x = 1, y = 1}, alignment = {x = 1, y = 1},
number = 0xFFFFFF, number = 0xFFFFFF,
text = "", text = "",
@ -1247,13 +1247,20 @@ if progressive_mode then
} }
end) end)
local to_save = {
"inv_items",
"known_recipes",
}
local function save_meta(player) local function save_meta(player)
local meta = player:get_meta() local meta = player:get_meta()
local name = player:get_player_name() local name = player:get_player_name()
local data = pdata[name] local data = pdata[name]
meta:set_string("inv_items", serialize(data.inv_items)) for i = 1, #to_save do
meta:set_string("known_recipes", serialize(data.known_recipes)) local meta_name = to_save[i]
meta:set_string(meta_name, serialize(data[meta_name]))
end
end end
core.register_on_leaveplayer(function(player) core.register_on_leaveplayer(function(player)