From 8b86dfc8570b72ca2a640b37afc11686fcf0cb29 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Fri, 30 Aug 2019 17:39:03 +0200 Subject: [PATCH] Fine-tune HUD --- init.lua | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index bb8d6b3..f6a748e 100644 --- a/init.lua +++ b/init.lua @@ -1223,15 +1223,15 @@ if progressive_mode then data.hud = { bg = player:hud_add({ hud_elem_type = "image", - position = {x = 0.8, y = 1}, + position = {x = 0.78, y = 1}, alignment = {x = 1, y = 1}, - scale = {x = 320, y = 112}, + scale = {x = 370, y = 112}, text = "craftguide_bg.png", }), book = player:hud_add({ hud_elem_type = "image", - position = {x = 0.81, y = 1.02}, + position = {x = 0.79, y = 1.02}, alignment = {x = 1, y = 1}, scale = {x = 4, y = 4}, text = "craftguide_book.png", @@ -1239,7 +1239,7 @@ if progressive_mode then text = player:hud_add({ hud_elem_type = "text", - position = {x = 0.85, y = 1.04}, + position = {x = 0.84, y = 1.04}, alignment = {x = 1, y = 1}, number = 0xFFFFFF, text = "", @@ -1247,13 +1247,20 @@ if progressive_mode then } end) + local to_save = { + "inv_items", + "known_recipes", + } + local function save_meta(player) local meta = player:get_meta() local name = player:get_player_name() local data = pdata[name] - meta:set_string("inv_items", serialize(data.inv_items)) - meta:set_string("known_recipes", serialize(data.known_recipes)) + for i = 1, #to_save do + local meta_name = to_save[i] + meta:set_string(meta_name, serialize(data[meta_name])) + end end core.register_on_leaveplayer(function(player)