2018-06-23 05:56:27 -07:00
|
|
|
-- Unified Inventory for Minetest >= 0.4.16
|
2013-09-21 12:40:20 -07:00
|
|
|
|
2013-09-28 15:15:37 -07:00
|
|
|
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
|
|
|
local worldpath = minetest.get_worldpath()
|
2018-04-02 04:33:36 -07:00
|
|
|
|
2013-09-28 15:15:37 -07:00
|
|
|
-- Data tables definitions
|
2015-02-05 01:03:07 -08:00
|
|
|
unified_inventory = {
|
|
|
|
activefilter = {},
|
|
|
|
active_search_direction = {},
|
|
|
|
alternate = {},
|
|
|
|
current_page = {},
|
|
|
|
current_searchbox = {},
|
|
|
|
current_index = {},
|
|
|
|
current_item = {},
|
|
|
|
current_craft_direction = {},
|
|
|
|
registered_craft_types = {},
|
|
|
|
crafts_for = {usage = {}, recipe = {} },
|
|
|
|
players = {},
|
|
|
|
items_list_size = 0,
|
|
|
|
items_list = {},
|
|
|
|
filtered_items_list_size = {},
|
|
|
|
filtered_items_list = {},
|
|
|
|
pages = {},
|
|
|
|
buttons = {},
|
|
|
|
|
|
|
|
-- Homepos stuff
|
|
|
|
home_pos = {},
|
|
|
|
home_filename = worldpath.."/unified_inventory_home.home",
|
|
|
|
|
|
|
|
-- Default inventory page
|
|
|
|
default = "craft",
|
|
|
|
|
2015-06-28 00:47:03 -07:00
|
|
|
-- "Lite" mode
|
2018-06-23 05:56:27 -07:00
|
|
|
lite_mode = minetest.settings:get_bool("unified_inventory_lite"),
|
2018-04-02 04:33:36 -07:00
|
|
|
|
2017-03-01 14:28:40 -08:00
|
|
|
-- Trash enabled
|
2018-06-23 05:56:27 -07:00
|
|
|
trash_enabled = (minetest.settings:get_bool("unified_inventory_trash") ~= false),
|
2015-06-28 00:47:03 -07:00
|
|
|
|
|
|
|
pagecols = 8,
|
|
|
|
pagerows = 10,
|
|
|
|
page_y = 0,
|
|
|
|
formspec_y = 1,
|
|
|
|
main_button_x = 0,
|
|
|
|
main_button_y = 9,
|
|
|
|
craft_result_x = 0.3,
|
2015-06-28 01:47:30 -07:00
|
|
|
craft_result_y = 0.5,
|
2015-06-28 00:47:03 -07:00
|
|
|
form_header_y = 0
|
2015-02-05 01:03:07 -08:00
|
|
|
}
|
2013-09-28 15:15:37 -07:00
|
|
|
|
|
|
|
-- Disable default creative inventory
|
2016-02-11 18:19:03 -08:00
|
|
|
local creative = rawget(_G, "creative") or rawget(_G, "creative_inventory")
|
|
|
|
if creative then
|
2016-02-08 04:07:23 -08:00
|
|
|
function creative.set_creative_formspec(player, start_i, pagenum)
|
2013-09-28 15:15:37 -07:00
|
|
|
return
|
2013-09-21 12:40:20 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-08-05 13:57:23 -07:00
|
|
|
-- Disable sfinv inventory
|
|
|
|
local sfinv = rawget(_G, "sfinv")
|
|
|
|
if sfinv then
|
|
|
|
sfinv.enabled = false
|
|
|
|
end
|
|
|
|
|
2014-05-11 19:00:32 -07:00
|
|
|
dofile(modpath.."/group.lua")
|
2013-09-28 15:15:37 -07:00
|
|
|
dofile(modpath.."/api.lua")
|
|
|
|
dofile(modpath.."/internal.lua")
|
|
|
|
dofile(modpath.."/callbacks.lua")
|
2019-10-26 08:22:33 -07:00
|
|
|
dofile(modpath.."/match_craft.lua")
|
2013-09-28 15:15:37 -07:00
|
|
|
dofile(modpath.."/register.lua")
|
2016-11-28 11:46:42 -08:00
|
|
|
|
2018-06-23 05:56:27 -07:00
|
|
|
if minetest.settings:get_bool("unified_inventory_bags") ~= false then
|
2016-11-28 11:46:42 -08:00
|
|
|
dofile(modpath.."/bags.lua")
|
|
|
|
end
|
2015-06-28 00:47:03 -07:00
|
|
|
|
2014-05-25 20:41:40 -07:00
|
|
|
dofile(modpath.."/item_names.lua")
|
2015-06-28 00:47:03 -07:00
|
|
|
|
2015-10-05 01:24:01 -07:00
|
|
|
if minetest.get_modpath("datastorage") then
|
2014-07-06 14:39:20 -07:00
|
|
|
dofile(modpath.."/waypoints.lua")
|
|
|
|
end
|