minetest-i4/i4/init.lua

128 lines
2.7 KiB
Lua
Raw Normal View History

local modpath = core.get_modpath"i4"
local http = core.request_http_api()
2022-01-08 09:40:10 -06:00
local storage = core.get_mod_storage()
2022-06-22 18:14:45 -05:00
local _loadfile = dofile(modpath .. "/src/preprocessor.lua")
2021-10-18 22:54:51 -05:00
local function lf(path)
return assert(_loadfile(modpath .. path))
2021-10-18 22:54:51 -05:00
end
i4 = {
version = 1162,
2022-01-08 09:40:10 -06:00
data = core.deserialize(storage:get_string"data") or {},
imported = storage:get_int"imported_from_i3",
2022-01-08 09:40:10 -06:00
2021-12-12 17:20:26 -06:00
settings = {
2023-01-31 21:17:03 -06:00
debug_mode = false,
2021-12-12 17:20:26 -06:00
max_favs = 6,
2022-01-16 11:16:56 -06:00
max_waypoints = 30,
min_fs_version = 6,
2021-12-12 17:20:26 -06:00
item_btn_size = 1.1,
drop_bag_on_die = true,
wielditem_fade_after = 3,
2021-12-12 17:20:26 -06:00
save_interval = 600, -- Player data save interval (in seconds)
2023-04-01 11:13:21 -05:00
hud_speed = 3,
2023-01-19 10:30:57 -06:00
hud_timer_max = 3,
2021-12-12 17:20:26 -06:00
damage_enabled = core.settings:get_bool"enable_damage",
progressive_mode = core.settings:get_bool"i4_progressive_mode" or core.settings:get_bool"i3_progressive_mode",
inventory_size = tonumber(core.settings:get"i4_inventory_size") or (storage:get_int"imported_from_i3" and 36),
2021-12-12 17:20:26 -06:00
},
2021-11-25 20:32:04 -06:00
-- S("Crafting"); S("Armor")
-- S("Waypoints"); S("Skins")
-- S("Bag")
2021-12-12 17:20:26 -06:00
categories = {
"crafting",
"armor",
"bag",
"skins",
"waypoints"
},
2021-12-12 17:20:26 -06:00
saves = { -- Metadata to save
bag = true,
home = true,
2022-09-25 10:11:07 -05:00
sort = true,
collapse = true,
2022-08-06 17:42:52 -05:00
font_size = true,
hide_tabs = true,
waypoints = true,
inv_items = true,
2022-09-25 10:11:07 -05:00
auto_sorting = true,
inv_compress = true,
known_recipes = true,
wielditem_hud = true,
2022-09-25 10:11:07 -05:00
ignore_hotbar = true,
reverse_sorting = true,
hotbar_len = true,
},
2022-09-25 10:11:07 -05:00
default_data = {
sort = 1,
font_size = 0,
collapse = true,
inv_compress = true,
hotbar_len = 8,
},
2021-10-18 22:54:51 -05:00
files = {
2021-11-28 16:55:11 -06:00
api = lf"/src/api.lua",
bags = lf"/src/bags.lua",
caches = lf"/src/caches.lua",
callbacks = lf"/src/callbacks.lua",
common = lf"/src/common.lua",
2022-06-23 07:32:59 -05:00
compress = lf"/src/compression.lua",
2021-11-28 16:55:11 -06:00
detached = lf"/src/detached_inv.lua",
2022-01-08 10:05:29 -06:00
fields = lf"/src/fields.lua",
2021-11-28 16:55:11 -06:00
groups = lf"/src/groups.lua",
gui = lf"/src/gui.lua",
hud = lf"/src/hud.lua",
model_alias = lf"/src/model_aliases.lua",
progressive = lf"/src/progressive.lua",
styles = lf"/src/styles.lua",
},
2021-01-15 20:30:12 -06:00
2021-12-12 17:20:26 -06:00
-- Caches
init_items = {},
fuel_cache = {},
usages_cache = {},
recipes_cache = {},
tabs = {},
cubes = {},
2022-06-18 12:47:23 -05:00
groups = {},
2021-12-12 17:20:26 -06:00
plants = {},
modules = {},
2023-01-18 18:24:45 -06:00
minitabs = {},
footer_buttons = {},
2021-12-12 17:20:26 -06:00
craft_types = {},
recipe_filters = {},
search_filters = {},
sorting_methods = {},
}
2021-01-15 18:46:26 -06:00
i3 = i4
i4.files.common()
i4.files.api(http)
i4.files.compress()
i4.files.detached()
i4.files.fields()
i4.files.groups()
i4.files.callbacks(http, storage)
2020-12-30 16:21:05 -06:00
if i4.settings.progressive_mode then
i4.files.progressive()
2021-01-21 17:42:48 -06:00
end
2020-12-30 16:21:05 -06:00
if i4.settings.debug_mode then
2022-01-02 07:30:03 -06:00
lf("/tests/test_tabs.lua")()
2023-01-07 05:28:07 -06:00
lf("/tests/test_waypoints.lua")()
2022-10-02 07:38:49 -05:00
-- lf("/tests/test_operators.lua")()
2022-01-02 07:30:03 -06:00
lf("/tests/test_compression.lua")()
lf("/tests/test_custom_recipes.lua")()
end