From aeb9841e3ab4fab5fa5457ddf101122a4408c710 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sat, 17 Jul 2021 10:35:39 +0200 Subject: [PATCH] Remove default hard dependency for use in devtest --- README.md | 4 ++++ category.lua | 11 ++++++----- init.lua | 2 +- internal.lua | 2 ++ mod.conf | 4 ++-- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d159c02..2659357 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,10 @@ Unified Inventory replaces the default survival and creative inventory. ## Requirements * Minetest 5.4.0+ + * Mod `default` for category filters (contained in Minetest Game) + * Mod `farming` for craftable bags (contained in Minetest Game) + * Mod `datastorage` for waypoints (deprecated) + # Licenses diff --git a/category.lua b/category.lua index 72e4038..d0fee5e 100644 --- a/category.lua +++ b/category.lua @@ -70,7 +70,7 @@ end local function ensure_category_exists(category_name) if not unified_inventory.registered_categories[category_name] then unified_inventory.registered_categories[category_name] = { - symbol = "default:stick", + symbol = "unknown_item.png", label = category_name } end @@ -81,16 +81,17 @@ end function unified_inventory.register_category(category_name, config) ensure_category_exists(category_name) - if config and config.symbol then + config = config or {} + if config.symbol then unified_inventory.set_category_symbol(category_name, config.symbol) end - if config and config.label then + if config.label then unified_inventory.set_category_label(category_name, config.label) end - if config and config.index then + if config.index then unified_inventory.set_category_index(category_name, config.index) end - if config and config.items then + if config.items then unified_inventory.add_category_items(category_name, config.items) end update_category_list() diff --git a/init.lua b/init.lua index 391eb3c..9cf6c0f 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,4 @@ --- Unified Inventory for Minetest >= 0.4.16 +-- Unified Inventory local modpath = minetest.get_modpath(minetest.get_current_modname()) local worldpath = minetest.get_worldpath() diff --git a/internal.lua b/internal.lua index f4d8b44..cdf71ed 100644 --- a/internal.lua +++ b/internal.lua @@ -29,6 +29,8 @@ local function formspec_button(ui_peruser, name, image, offset, pos, scale, labe local element = 'image_button' if minetest.registered_items[image] then element = 'item_image_button' + elseif image:find(":", 1, true) then + image = "unknown_item.png" end local spc = (1-scale)*ui_peruser.btn_size/2 local size = ui_peruser.btn_size*scale diff --git a/mod.conf b/mod.conf index 89be528..3d27d29 100644 --- a/mod.conf +++ b/mod.conf @@ -1,6 +1,6 @@ name = unified_inventory -depends = default -optional_depends = creative, sfinv, datastorage, farming + +optional_depends = default, creative, sfinv, datastorage, farming description = """ Unified Inventory replaces the default survival and creative inventory. It adds a nicer interface and a number of features, such as a crafting guide.