minetest-i4/i3/init.lua
Jaidyn Ann 4c8688190a Add setting for inventory-size (i4_inventory_size)
Also removes the “legacy inventory” user-setting,
and defaults to 32 for inventory size.
I feel that the individual players shouldn’t be
able to tweak their inventory-size, that’s a
server-level sort of setting.
2024-01-15 12:52:18 -06:00

22 lines
798 B
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 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