Minor fix

This commit is contained in:
Jean-Patrick Guerrero 2020-12-31 00:17:38 +01:00
parent ea287144e3
commit 124c4aef46
1 changed files with 15 additions and 14 deletions

View File

@ -1697,7 +1697,8 @@ local function get_inventory_mode(player, fs, data, full_height)
local name = player:get_player_name() local name = player:get_player_name()
fs(fmt("model", 0.2, 0.2, 4, 5.4, "player_model", fs(fmt("model", 0.2, 0.2, 4, 5.4, "player_model",
player_props.mesh, concat(player_props.textures, ","), "0,-150", "false", "0,0")) player_props.mesh or "character.b3d", concat(player_props.textures, ","),
"0,-150", "false", "0,0"))
local xoffset = __3d_armor and 0 or 4.5 local xoffset = __3d_armor and 0 or 4.5
@ -2056,10 +2057,12 @@ local function init_data(player, name)
creative = core.is_creative_enabled(name), creative = core.is_creative_enabled(name),
} }
local data = pdata[name] after(0, function()
local fs = make_fs(player, data) local data = pdata[name]
local fs = make_fs(player, data)
player:set_inventory_formspec(fs) player:set_inventory_formspec(fs)
end)
end end
local function reset_data(data) local function reset_data(data)
@ -2101,15 +2104,13 @@ on_mods_loaded(function()
end) end)
on_joinplayer(function(player) on_joinplayer(function(player)
after(0, function() local name = player:get_player_name()
local name = player:get_player_name() init_data(player, name)
init_data(player, name) local data = pdata[name]
local data = pdata[name]
if data.fs_version < MIN_FORMSPEC_VERSION then if data.fs_version < MIN_FORMSPEC_VERSION then
outdated(name) outdated(name)
end end
end)
end) end)
on_receive_fields(function(player, formname, _f) on_receive_fields(function(player, formname, _f)
@ -2397,7 +2398,7 @@ if progressive_mode then
local data = pdata[name] local data = pdata[name]
local inv_items = get_inv_items(player) local inv_items = get_inv_items(player)
local diff = array_diff(inv_items, data.inv_items) local diff = array_diff(inv_items, data.inv_items or {})
if #diff > 0 then if #diff > 0 then
data.inv_items = table_merge(diff, data.inv_items) data.inv_items = table_merge(diff, data.inv_items)
@ -2439,8 +2440,8 @@ if progressive_mode then
on_joinplayer(function(player) on_joinplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
local data = pdata[name] local data = pdata[name]
local meta = player:get_meta() local meta = player:get_meta()
data.inv_items = dslz(meta:get_string "inv_items") or {} data.inv_items = dslz(meta:get_string "inv_items") or {}
data.known_recipes = dslz(meta:get_string "known_recipes") or 0 data.known_recipes = dslz(meta:get_string "known_recipes") or 0