d197e1f1e3
move function `item_matches` from `bg_crafting` into `bg_api`, since it'll be useful in many other places.
12 lines
311 B
Lua
12 lines
311 B
Lua
function blockgame.item_matches (name, options)
|
|
return blockgame.any(options, function (option)
|
|
if name == option then return true end
|
|
|
|
if blockgame.starts_with(option, "group:") then
|
|
local group = string.sub(option, 7)
|
|
return minetest.get_item_group(name, group) > 0
|
|
end
|
|
|
|
return false
|
|
end)
|
|
end
|