cartographer/init.lua

50 lines
2.5 KiB
Lua
Raw Normal View History

-- The path to this mod, for including files
local modpath = minetest.get_modpath("cartographer");
2020-06-13 16:21:34 -04:00
local settings = {
default_size = tonumber(minetest.settings:get("default_size")) or 40,
autofill_freq = tonumber(minetest.settings:get("autofill_freq")) or 5,
autosave_freq = tonumber(minetest.settings:get("autosave_freq")) or 60,
backup_scan_freq = tonumber(minetest.settings:get("backup_scan_freq")) or 5,
2020-06-13 16:50:34 -04:00
backup_scan_count = tonumber(minetest.settings:get("backup_scan_count")) or 20,
2020-06-13 16:21:34 -04:00
};
2020-02-16 12:55:07 -05:00
-- Includes
2022-04-20 11:12:34 +00:00
local map_data,private_storage = loadfile(modpath .. "/storage.lua") (settings);
local chunk = loadfile(modpath .. "/chunk_api.lua") ();
local gui = loadfile(modpath .. "/formspec.lua") ();
2020-06-13 08:50:36 -04:00
local skin = loadfile(modpath .. "/skin_api.lua") ();
local util = loadfile(modpath .. "/util.lua") ();
2020-06-13 08:50:36 -04:00
local audio = loadfile(modpath .. "/audio.lua") ();
2022-04-20 11:12:34 +00:00
local biomes = loadfile(modpath .. "/biome_api.lua") (map_data, util, skin);
2020-06-13 08:50:36 -04:00
local markers = loadfile(modpath .. "/marker_api.lua") ();
2022-04-20 11:12:34 +00:00
local scanner = loadfile(modpath .. "/scanner.lua") (map_data, chunk, settings, biomes);
2020-06-10 20:54:00 -04:00
local maps = loadfile(modpath .. "/map_api.lua") (map_data, chunk);
local materials = loadfile(modpath .. "/material_api.lua") ();
local map_formspec = loadfile(modpath .. "/map_formspec.lua") (map_data, gui, skin, util, biomes, markers);
2020-06-13 16:21:34 -04:00
local map_item = loadfile(modpath .. "/items.lua") (chunk, gui, skin, audio, maps, markers, map_formspec, settings);
loadfile(modpath .. "/commands.lua") (chunk, audio, map_formspec, settings);
loadfile(modpath .. "/table.lua") (gui, skin, audio, maps, materials, map_item, settings);
loadfile(modpath .. "/autofill.lua") (chunk, scanner, maps, settings);
2020-06-10 20:10:15 -04:00
-- The API object
cartographer = {
-- skin_api.lua: Allows the visual customization of formspecs
2020-06-13 16:21:34 -04:00
skin = skin,
-- biome_api.lua: Allows biome data to be registered for display in maps
2020-06-13 16:21:34 -04:00
biomes = biomes,
-- marker_api.lua: Allows markers to be registered for placement on maps
2020-06-13 16:21:34 -04:00
markers = markers,
-- map_api.lua: Allows the creation, lookup, and management of map objects
2020-06-13 16:21:34 -04:00
maps = maps,
-- items.lua: Allows the creation of map items with proper metadata
2020-06-13 16:21:34 -04:00
map_item = map_item,
-- materials.lua: Allows items to be registered as mapmaking materials
2020-06-13 16:21:34 -04:00
materials = materials,
-- scanner.lua: Exposes functions for queuing and performing terrain scans
scanner = scanner,
}
2022-04-20 11:12:34 +00:00
-- If the API is out of date, update it now
private_storage.migrate_data(map_data.api_version, cartographer)