minetest-i4/i3/init.lua

22 lines
798 B
Lua
Raw Normal View History

-- This is a placeholder mod, to mimic i3s presence for mods that test for it.
-- It also migrates data from i3 to i4.
local storage = core.get_mod_storage("i3")
local data = core.deserialize(storage:get_string"data") or {}
if data and not i4.imported then
-- i3 stores all user-data in a mod-data table; we copy it verbatim to i4.
i4.data = data
-- By default, i4s inventory-size is 32; i3s, however, is 36. i4 will
-- default to 36 at init-time if data was imported from i3. But since were
-- only importing now (and i4 has already been initialized), we need to do
-- it ourselves this time.
if not i4.settings.inventory_size then
i4.settings.inventory_size = 36
end
-- Mark data as imported, so we dont go through this song-and-dance again.
i4.imported = true
end