From e8a811f72ccdb60b89552797c02ae9c8861bf074 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Sun, 25 Sep 2022 17:11:07 +0200 Subject: [PATCH] Save more settings accross restarts --- init.lua | 9 ++++++++- src/callbacks.lua | 9 ++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index 091ccb0..db52a58 100644 --- a/init.lua +++ b/init.lua @@ -51,17 +51,24 @@ i3 = { saves = { -- Metadata to save bag = true, home = true, + sort = true, collapse = true, font_size = true, hide_tabs = true, waypoints = true, inv_items = true, + auto_sorting = true, + inv_compress = true, known_recipes = true, wielditem_hud = true, + ignore_hotbar = true, + reverse_sorting = true, legacy_inventory = true, }, - default_enabled = { + default_data = { + sort = 1, + font_size = 0, collapse = true, inv_compress = true, }, diff --git a/src/callbacks.lua b/src/callbacks.lua index 7015f22..3b65c26 100644 --- a/src/callbacks.lua +++ b/src/callbacks.lua @@ -205,11 +205,11 @@ local function init_data(player, info) local data = i3.data[name] local default = {} - for k in pairs(i3.default_enabled) do + for k, v in pairs(i3.default_data) do default[k] = data[k] if data[k] == nil then - default[k] = true + default[k] = v end data[k] = default[k] @@ -223,16 +223,11 @@ local function init_data(player, info) data.items_raw = i3.init_items data.favs = {} data.show_setting = "home" - data.ignore_hotbar = false - data.auto_sorting = false - data.reverse_sorting = false data.crafting_counts = {} - data.sort = 1 data.tab = 1 data.itab = 1 data.subcat = 1 data.scrbar_inv = 0 - data.font_size = data.font_size or 0 data.lang_code = get_lang_code(info) data.fs_version = info.formspec_version