Remove default hard dependency for use in devtest

This commit is contained in:
SmallJoker 2021-07-17 10:35:39 +02:00
parent afd38e0c73
commit aeb9841e3a
5 changed files with 15 additions and 8 deletions

@ -25,6 +25,10 @@ Unified Inventory replaces the default survival and creative inventory.
## Requirements ## Requirements
* Minetest 5.4.0+ * 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 # Licenses

@ -70,7 +70,7 @@ end
local function ensure_category_exists(category_name) local function ensure_category_exists(category_name)
if not unified_inventory.registered_categories[category_name] then if not unified_inventory.registered_categories[category_name] then
unified_inventory.registered_categories[category_name] = { unified_inventory.registered_categories[category_name] = {
symbol = "default:stick", symbol = "unknown_item.png",
label = category_name label = category_name
} }
end end
@ -81,16 +81,17 @@ end
function unified_inventory.register_category(category_name, config) function unified_inventory.register_category(category_name, config)
ensure_category_exists(category_name) 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) unified_inventory.set_category_symbol(category_name, config.symbol)
end end
if config and config.label then if config.label then
unified_inventory.set_category_label(category_name, config.label) unified_inventory.set_category_label(category_name, config.label)
end end
if config and config.index then if config.index then
unified_inventory.set_category_index(category_name, config.index) unified_inventory.set_category_index(category_name, config.index)
end end
if config and config.items then if config.items then
unified_inventory.add_category_items(category_name, config.items) unified_inventory.add_category_items(category_name, config.items)
end end
update_category_list() update_category_list()

@ -1,4 +1,4 @@
-- Unified Inventory for Minetest >= 0.4.16 -- Unified Inventory
local modpath = minetest.get_modpath(minetest.get_current_modname()) local modpath = minetest.get_modpath(minetest.get_current_modname())
local worldpath = minetest.get_worldpath() local worldpath = minetest.get_worldpath()

@ -29,6 +29,8 @@ local function formspec_button(ui_peruser, name, image, offset, pos, scale, labe
local element = 'image_button' local element = 'image_button'
if minetest.registered_items[image] then if minetest.registered_items[image] then
element = 'item_image_button' element = 'item_image_button'
elseif image:find(":", 1, true) then
image = "unknown_item.png"
end end
local spc = (1-scale)*ui_peruser.btn_size/2 local spc = (1-scale)*ui_peruser.btn_size/2
local size = ui_peruser.btn_size*scale local size = ui_peruser.btn_size*scale

@ -1,6 +1,6 @@
name = unified_inventory name = unified_inventory
depends = default
optional_depends = creative, sfinv, datastorage, farming optional_depends = default, creative, sfinv, datastorage, farming
description = """ description = """
Unified Inventory replaces the default survival and creative inventory. Unified Inventory replaces the default survival and creative inventory.
It adds a nicer interface and a number of features, such as a crafting guide. It adds a nicer interface and a number of features, such as a crafting guide.