2018-06-23 14:56:27 +02:00
|
|
|
-- Unified Inventory for Minetest >= 0.4.16
|
2013-09-21 21:40:20 +02:00
|
|
|
|
2013-09-29 00:15:37 +02:00
|
|
|
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
|
|
|
local worldpath = minetest.get_worldpath()
|
2018-04-02 13:33:36 +02:00
|
|
|
|
2013-09-29 00:15:37 +02:00
|
|
|
-- Data tables definitions
|
2015-02-05 10:03:07 +01: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 09:47:03 +02:00
|
|
|
-- "Lite" mode
|
2018-06-23 14:56:27 +02:00
|
|
|
lite_mode = minetest.settings:get_bool("unified_inventory_lite"),
|
2018-04-02 13:33:36 +02:00
|
|
|
|
2017-03-01 23:28:40 +01:00
|
|
|
-- Trash enabled
|
2018-06-23 14:56:27 +02:00
|
|
|
trash_enabled = (minetest.settings:get_bool("unified_inventory_trash") ~= false),
|
2015-06-28 09:47:03 +02:00
|
|
|
|
2021-03-05 16:58:18 +01:00
|
|
|
formspec_x = 1, -- UI doesn't use these first two anymore, but other mods
|
|
|
|
formspec_y = 1, -- may need them.
|
2015-06-28 09:47:03 +02:00
|
|
|
pagecols = 8,
|
|
|
|
pagerows = 10,
|
2021-03-05 16:58:18 +01:00
|
|
|
page_x = 10.75,
|
|
|
|
page_y = 1.25,
|
|
|
|
craft_x = 2.8,
|
|
|
|
craft_y = 1,
|
|
|
|
resultstr_y = 0.6,
|
|
|
|
main_button_x = 0.4,
|
|
|
|
main_button_y = 11.0,
|
|
|
|
page_buttons_x = 11.60,
|
|
|
|
page_buttons_y = 10.15,
|
|
|
|
searchwidth = 3.4,
|
|
|
|
form_header_x = 0.4,
|
|
|
|
form_header_y = 0.4,
|
|
|
|
btn_spc = 0.85,
|
|
|
|
btn_size = 0.75,
|
|
|
|
imgscale = 1.25,
|
|
|
|
std_inv_x = 0.3,
|
|
|
|
std_inv_y = 5.5,
|
2021-03-07 01:05:27 +01:00
|
|
|
standard_background = "background9[0,0;1,1;ui_formbg_9_sliced.png;true;16]",
|
2015-02-05 10:03:07 +01:00
|
|
|
}
|
2013-09-29 00:15:37 +02:00
|
|
|
|
2021-03-05 16:58:18 +01:00
|
|
|
uninv = unified_inventory
|
|
|
|
|
|
|
|
uninv.standard_inv = "list[current_player;main;"..(uninv.std_inv_x+0.15)..","..(uninv.std_inv_y+0.15)..";8,4;]"
|
|
|
|
uninv.standard_inv_bg = "image["..uninv.std_inv_x..","..uninv.std_inv_y..";"..(uninv.imgscale*8)..
|
|
|
|
","..(uninv.imgscale*4)..";ui_main_inventory.png]"
|
|
|
|
|
2013-09-29 00:15:37 +02:00
|
|
|
-- Disable default creative inventory
|
2016-02-12 03:19:03 +01:00
|
|
|
local creative = rawget(_G, "creative") or rawget(_G, "creative_inventory")
|
|
|
|
if creative then
|
2016-02-08 13:07:23 +01:00
|
|
|
function creative.set_creative_formspec(player, start_i, pagenum)
|
2013-09-29 00:15:37 +02:00
|
|
|
return
|
2013-09-21 21:40:20 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-08-05 22:57:23 +02:00
|
|
|
-- Disable sfinv inventory
|
|
|
|
local sfinv = rawget(_G, "sfinv")
|
|
|
|
if sfinv then
|
|
|
|
sfinv.enabled = false
|
|
|
|
end
|
|
|
|
|
2014-05-12 04:00:32 +02:00
|
|
|
dofile(modpath.."/group.lua")
|
2013-09-29 00:15:37 +02:00
|
|
|
dofile(modpath.."/api.lua")
|
|
|
|
dofile(modpath.."/internal.lua")
|
|
|
|
dofile(modpath.."/callbacks.lua")
|
2019-10-26 17:22:33 +02:00
|
|
|
dofile(modpath.."/match_craft.lua")
|
2013-09-29 00:15:37 +02:00
|
|
|
dofile(modpath.."/register.lua")
|
2016-11-28 20:46:42 +01:00
|
|
|
|
2018-06-23 14:56:27 +02:00
|
|
|
if minetest.settings:get_bool("unified_inventory_bags") ~= false then
|
2016-11-28 20:46:42 +01:00
|
|
|
dofile(modpath.."/bags.lua")
|
|
|
|
end
|
2015-06-28 09:47:03 +02:00
|
|
|
|
2014-05-26 05:41:40 +02:00
|
|
|
dofile(modpath.."/item_names.lua")
|
2015-06-28 09:47:03 +02:00
|
|
|
|
2015-10-05 10:24:01 +02:00
|
|
|
if minetest.get_modpath("datastorage") then
|
2014-07-06 23:39:20 +02:00
|
|
|
dofile(modpath.."/waypoints.lua")
|
|
|
|
end
|