Fix sfinv issue

This commit is contained in:
Jean-Patrick Guerrero 2021-01-26 23:36:24 +01:00
parent ae5164509c
commit 797db59345

View File

@ -16,7 +16,7 @@ local progressive_mode = core.settings:get_bool "i3_progressive_mode"
local damage_enabled = core.settings:get_bool "enable_damage" local damage_enabled = core.settings:get_bool "enable_damage"
local __3darmor, __skinsdb, __awards local __3darmor, __skinsdb, __awards
local sfinv, unified_inventory, old_unified_inventory_fn local sfinv, old_sfinv_fn, unified_inventory, old_unified_inventory_fn
local http = core.request_http_api() local http = core.request_http_api()
local singleplayer = core.is_singleplayer() local singleplayer = core.is_singleplayer()
@ -2668,6 +2668,8 @@ on_mods_loaded(function()
sfinv = rawget(_G, "sfinv") sfinv = rawget(_G, "sfinv")
if sfinv then if sfinv then
old_sfinv_fn = sfinv.set_player_inventory_formspec
function sfinv.set_player_inventory_formspec() return end
sfinv.enabled = false sfinv.enabled = false
end end
@ -2732,7 +2734,10 @@ on_joinplayer(function(player)
local info = get_player_info(name) local info = get_player_info(name)
if get_formspec_version(info) < MIN_FORMSPEC_VERSION then if get_formspec_version(info) < MIN_FORMSPEC_VERSION then
if sfinv then
sfinv.enabled = true sfinv.enabled = true
sfinv.set_player_inventory_formspec = old_sfinv_fn
end
if unified_inventory then if unified_inventory then
unified_inventory.set_inventory_formspec = old_unified_inventory_fn unified_inventory.set_inventory_formspec = old_unified_inventory_fn