forked from minetest-mods/unified_inventory
Merge remote-tracking branch 'github/master'
This commit is contained in:
commit
8c56e27c94
3
api.lua
3
api.lua
@ -151,7 +151,7 @@ minetest.after(0.01, function()
|
||||
-- Step 2: Find all matching items for the given spec (groups)
|
||||
local function get_matching_spec_items(specname)
|
||||
if specname:sub(1,6) ~= "group:" then
|
||||
return { specname }
|
||||
return { [specname] = true }
|
||||
end
|
||||
|
||||
local accepted = {}
|
||||
@ -177,6 +177,7 @@ minetest.after(0.01, function()
|
||||
end
|
||||
|
||||
for _, recipes in pairs(ui.crafts_for.recipe) do
|
||||
-- List of crafts that return this item string (variable "_")
|
||||
for _, recipe in ipairs(recipes) do
|
||||
local ingredient_items = {}
|
||||
for _, spec in pairs(recipe.items) do
|
||||
|
@ -19,14 +19,12 @@ minetest.register_on_joinplayer(function(player)
|
||||
unified_inventory.items_list
|
||||
unified_inventory.activefilter[player_name] = ""
|
||||
unified_inventory.active_search_direction[player_name] = "nochange"
|
||||
unified_inventory.apply_filter(player, "", "nochange")
|
||||
unified_inventory.current_searchbox[player_name] = ""
|
||||
unified_inventory.current_category[player_name] = "all"
|
||||
unified_inventory.current_category_scroll[player_name] = 0
|
||||
unified_inventory.alternate[player_name] = 1
|
||||
unified_inventory.current_item[player_name] = nil
|
||||
unified_inventory.current_craft_direction[player_name] = "recipe"
|
||||
unified_inventory.set_inventory_formspec(player, unified_inventory.default)
|
||||
|
||||
-- Refill slot
|
||||
local refill = minetest.create_detached_inventory(player_name.."refill", {
|
||||
@ -48,6 +46,14 @@ minetest.register_on_joinplayer(function(player)
|
||||
refill:set_size("main", 1)
|
||||
end)
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
-- After everything is initialized, set up the formspec
|
||||
ui.apply_filter(player, "", "nochange")
|
||||
ui.set_inventory_formspec(player, unified_inventory.default)
|
||||
end)
|
||||
end)
|
||||
|
||||
local function apply_new_filter(player, search_text, new_dir)
|
||||
local player_name = player:get_player_name()
|
||||
|
||||
|
2
init.lua
2
init.lua
@ -50,7 +50,7 @@ unified_inventory = {
|
||||
trash_enabled = (minetest.settings:get_bool("unified_inventory_trash") ~= false),
|
||||
imgscale = 1.25,
|
||||
list_img_offset = 0.13,
|
||||
standard_background = "background9[0,0;1,1;ui_formbg_9_sliced.png;true;16]",
|
||||
standard_background = "bgcolor[#0000]background9[0,0;1,1;ui_formbg_9_sliced.png;true;16]",
|
||||
|
||||
version = 4
|
||||
}
|
||||
|
14
internal.lua
14
internal.lua
@ -115,9 +115,9 @@ local function formspec_add_categories(player, formspec, ui_peruser)
|
||||
ui_peruser.form_header_y - (ui_peruser.is_lite_mode and 0 or 0.2)
|
||||
}
|
||||
|
||||
formspec[n] = string.format("background9[%f,%f;%f,%f;%s;false;3]",
|
||||
ui_peruser.page_x-0.1, categories_scroll_pos[2],
|
||||
(ui_peruser.btn_spc * ui_peruser.pagecols) + 0.13, 1.4 + (ui_peruser.is_lite_mode and 0 or 0.2),
|
||||
formspec[n] = string.format("background9[%f,%f;%f,%f;%s;false;16]",
|
||||
ui_peruser.page_x-0.15, categories_scroll_pos[2],
|
||||
(ui_peruser.btn_spc * ui_peruser.pagecols) + 0.2, 1.4 + (ui_peruser.is_lite_mode and 0 or 0.2),
|
||||
"ui_smallbg_9_sliced.png")
|
||||
n = n + 1
|
||||
|
||||
@ -256,8 +256,14 @@ local function formspec_add_item_browser(player, formspec, ui_peruser)
|
||||
ui_peruser.btn_size, ui_peruser.btn_size,
|
||||
name, button_name
|
||||
)
|
||||
local tooltip = item.description
|
||||
if item.mod_origin then
|
||||
-- "mod_origin" may not be specified for items that were
|
||||
-- registered in a callback (during or before ServerEnv init)
|
||||
tooltip = tooltip .. " [" .. item.mod_origin .. "]"
|
||||
end
|
||||
formspec[n + 1] = ("tooltip[%s;%s]"):format(
|
||||
button_name, minetest.formspec_escape(item.description)
|
||||
button_name, minetest.formspec_escape(tooltip)
|
||||
)
|
||||
n = n + 2
|
||||
list_index = list_index + 1
|
||||
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 220 KiB |
Binary file not shown.
Before Width: | Height: | Size: 240 B After Width: | Height: | Size: 510 B |
Binary file not shown.
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 551 B |
Loading…
Reference in New Issue
Block a user