Save more settings accross restarts

This commit is contained in:
Jean-Patrick Guerrero 2022-09-25 17:11:07 +02:00
parent 4c4911eb4f
commit e8a811f72c
2 changed files with 10 additions and 8 deletions

View File

@ -51,17 +51,24 @@ i3 = {
saves = { -- Metadata to save saves = { -- Metadata to save
bag = true, bag = true,
home = true, home = true,
sort = true,
collapse = true, collapse = true,
font_size = true, font_size = true,
hide_tabs = true, hide_tabs = true,
waypoints = true, waypoints = true,
inv_items = true, inv_items = true,
auto_sorting = true,
inv_compress = true,
known_recipes = true, known_recipes = true,
wielditem_hud = true, wielditem_hud = true,
ignore_hotbar = true,
reverse_sorting = true,
legacy_inventory = true, legacy_inventory = true,
}, },
default_enabled = { default_data = {
sort = 1,
font_size = 0,
collapse = true, collapse = true,
inv_compress = true, inv_compress = true,
}, },

View File

@ -205,11 +205,11 @@ local function init_data(player, info)
local data = i3.data[name] local data = i3.data[name]
local default = {} local default = {}
for k in pairs(i3.default_enabled) do for k, v in pairs(i3.default_data) do
default[k] = data[k] default[k] = data[k]
if data[k] == nil then if data[k] == nil then
default[k] = true default[k] = v
end end
data[k] = default[k] data[k] = default[k]
@ -223,16 +223,11 @@ local function init_data(player, info)
data.items_raw = i3.init_items data.items_raw = i3.init_items
data.favs = {} data.favs = {}
data.show_setting = "home" data.show_setting = "home"
data.ignore_hotbar = false
data.auto_sorting = false
data.reverse_sorting = false
data.crafting_counts = {} data.crafting_counts = {}
data.sort = 1
data.tab = 1 data.tab = 1
data.itab = 1 data.itab = 1
data.subcat = 1 data.subcat = 1
data.scrbar_inv = 0 data.scrbar_inv = 0
data.font_size = data.font_size or 0
data.lang_code = get_lang_code(info) data.lang_code = get_lang_code(info)
data.fs_version = info.formspec_version data.fs_version = info.formspec_version