mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-08 11:30:21 +01:00
Updated unified_inventory
- Added system hidding crafts involving unknown items - Solves #186
This commit is contained in:
parent
21e53d2ac6
commit
9a4787834b
|
@ -19,12 +19,25 @@ minetest.after(0.01, function()
|
|||
local recipes = minetest.get_all_craft_recipes(name)
|
||||
if recipes then
|
||||
for _, recipe in ipairs(recipes) do
|
||||
|
||||
local unknowns
|
||||
|
||||
for _,chk in pairs(recipe.items) do
|
||||
local groupchk = string.find(chk, "group:")
|
||||
if (not groupchk and not minetest.registered_items[chk])
|
||||
or (groupchk and not unified_inventory.get_group_item(string.gsub(chk, "group:", "")).item) then
|
||||
unknowns = true
|
||||
end
|
||||
end
|
||||
|
||||
if not unknowns then
|
||||
unified_inventory.register_craft(recipe)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(unified_inventory.items_list)
|
||||
unified_inventory.items_list_size = #unified_inventory.items_list
|
||||
minetest.log("Unified Inventory. inventory size: "..unified_inventory.items_list_size)
|
||||
|
|
|
@ -3,13 +3,7 @@
|
|||
-- Copyright (c) 2012 cornernote, Brett O'Donnell <cornernote@gmail.com>
|
||||
-- License: GPLv3
|
||||
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
local S = unified_inventory.gettext
|
||||
|
||||
unified_inventory.register_page("bags", {
|
||||
get_formspec = function(player)
|
||||
|
|
|
@ -83,3 +83,4 @@ dofile(modpath.."/item_names.lua")
|
|||
if minetest.get_modpath("datastorage") and not unified_inventory.lite_mode then
|
||||
dofile(modpath.."/waypoints.lua")
|
||||
end
|
||||
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
local S = unified_inventory.gettext
|
||||
|
||||
-- This pair of encoding functions is used where variable text must go in
|
||||
-- button names, where the text might contain formspec metacharacters.
|
||||
|
@ -63,6 +57,7 @@ function unified_inventory.get_formspec(player, page)
|
|||
button_row = 1
|
||||
i = 1
|
||||
end
|
||||
|
||||
local tooltip = def.tooltip or ""
|
||||
if def.type == "image" then
|
||||
formspec = formspec.."image_button["
|
||||
|
@ -214,7 +209,11 @@ function unified_inventory.apply_filter(player, filter, search_dir)
|
|||
end
|
||||
unified_inventory.filtered_items_list[player_name]={}
|
||||
for name, def in pairs(minetest.registered_items) do
|
||||
if (def.groups.not_in_creative_inventory or 0) == 0 and (def.description or "") ~= "" and ffilter(name, def) then
|
||||
if (def.groups.not_in_creative_inventory or 0) == 0
|
||||
and (def.description or "") ~= ""
|
||||
and ffilter(name, def)
|
||||
and (unified_inventory.is_creative(player_name)
|
||||
or unified_inventory.crafts_for.recipe[def.name]) then
|
||||
table.insert(unified_inventory.filtered_items_list[player_name], name)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
local timers = {}
|
||||
local HOME_INTERVAL = 30*60
|
||||
local S = unified_inventory.gettext
|
||||
|
||||
minetest.register_privilege("creative", {
|
||||
description = "Can use the creative inventory",
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
local S
|
||||
if intllib then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
local S = unified_inventory.gettext
|
||||
|
||||
local hud_colors = {
|
||||
{"#FFFFFF", 0xFFFFFF, S("White")},
|
||||
|
|
Loading…
Reference in New Issue
Block a user