2013-09-29 00:15:37 +02:00
|
|
|
-- Unified Inventory for Minetest 0.4.8+
|
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()
|
2016-08-06 17:23:46 +02:00
|
|
|
local mygettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
|
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",
|
|
|
|
|
|
|
|
-- intllib
|
2016-08-06 17:23:46 +02:00
|
|
|
gettext = mygettext,
|
|
|
|
fgettext = function(s) return minetest.formspec_escape(mygettext(s)) end,
|
2015-06-28 09:47:03 +02:00
|
|
|
|
|
|
|
-- "Lite" mode
|
|
|
|
lite_mode = minetest.setting_getbool("unified_inventory_lite"),
|
|
|
|
|
|
|
|
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 10:47:30 +02:00
|
|
|
craft_result_y = 0.5,
|
2015-06-28 09:47:03 +02:00
|
|
|
form_header_y = 0
|
2015-02-05 10:03:07 +01:00
|
|
|
}
|
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
|
|
|
|
|
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")
|
|
|
|
dofile(modpath.."/register.lua")
|
2015-10-05 10:24:01 +02:00
|
|
|
dofile(modpath.."/bags.lua")
|
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
|
|
|
|
|