init.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. -- Unified Inventory for Minetest >= 0.4.16
  2. local modpath = minetest.get_modpath(minetest.get_current_modname())
  3. local worldpath = minetest.get_worldpath()
  4. -- Data tables definitions
  5. unified_inventory = {
  6. activefilter = {},
  7. active_search_direction = {},
  8. alternate = {},
  9. current_page = {},
  10. current_searchbox = {},
  11. current_index = {},
  12. current_item = {},
  13. current_craft_direction = {},
  14. registered_craft_types = {},
  15. crafts_for = {usage = {}, recipe = {} },
  16. players = {},
  17. items_list_size = 0,
  18. items_list = {},
  19. filtered_items_list_size = {},
  20. filtered_items_list = {},
  21. pages = {},
  22. buttons = {},
  23. -- Homepos stuff
  24. home_pos = {},
  25. home_filename = worldpath.."/unified_inventory_home.home",
  26. -- Default inventory page
  27. default = "craft",
  28. -- "Lite" mode
  29. lite_mode = minetest.settings:get_bool("unified_inventory_lite"),
  30. -- Trash enabled
  31. trash_enabled = (minetest.settings:get_bool("unified_inventory_trash") ~= false),
  32. pagecols = 8,
  33. pagerows = 10,
  34. page_y = 0,
  35. formspec_y = 1,
  36. main_button_x = 0,
  37. main_button_y = 9,
  38. craft_result_x = 0.3,
  39. craft_result_y = 0.5,
  40. form_header_y = 0
  41. }
  42. -- Disable default creative inventory
  43. local creative = rawget(_G, "creative") or rawget(_G, "creative_inventory")
  44. if creative then
  45. function creative.set_creative_formspec(player, start_i, pagenum)
  46. return
  47. end
  48. end
  49. -- Disable sfinv inventory
  50. local sfinv = rawget(_G, "sfinv")
  51. if sfinv then
  52. sfinv.enabled = false
  53. end
  54. dofile(modpath.."/group.lua")
  55. dofile(modpath.."/api.lua")
  56. dofile(modpath.."/internal.lua")
  57. dofile(modpath.."/callbacks.lua")
  58. dofile(modpath.."/match_craft.lua")
  59. dofile(modpath.."/register.lua")
  60. if minetest.settings:get_bool("unified_inventory_bags") ~= false then
  61. dofile(modpath.."/bags.lua")
  62. end
  63. dofile(modpath.."/item_names.lua")
  64. if minetest.get_modpath("datastorage") then
  65. dofile(modpath.."/waypoints.lua")
  66. end