2024-01-15 12:51:04 -06:00
|
|
|
|
-- This is a placeholder mod, to mimic i3’s presence for mods that test for it.
|
|
|
|
|
-- It also migrates data from i3 to i4.
|
2024-01-12 13:10:36 -06:00
|
|
|
|
|
|
|
|
|
local storage = core.get_mod_storage("i3")
|
|
|
|
|
local data = core.deserialize(storage:get_string"data") or {}
|
|
|
|
|
|
|
|
|
|
if data and not i4.imported then
|
2024-01-15 12:51:04 -06:00
|
|
|
|
-- i3 stores all user-data in a mod-data table; we copy it verbatim to i4.
|
2024-01-12 13:10:36 -06:00
|
|
|
|
i4.data = data
|
2024-01-15 12:51:04 -06:00
|
|
|
|
|
|
|
|
|
-- By default, i4’s inventory-size is 32; i3’s, however, is 36. i4 will
|
|
|
|
|
-- default to 36 at init-time if data was imported from i3. But since we’re
|
|
|
|
|
-- 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 don’t go through this song-and-dance again.
|
2024-01-12 13:10:36 -06:00
|
|
|
|
i4.imported = true
|
|
|
|
|
end
|