Use proper get_item_group accessor.

Instead of directly accessing the group table in node definitions, use
the proper minetest.get_item_group accessor to test for "cauldron"
group.
Also adds local alias get_item_group for the global minetest call.
This commit is contained in:
kabou 2022-02-20 18:06:04 +01:00
parent 13baa68b67
commit b3aed9d6b8

View File

@ -24,7 +24,7 @@ local add_node = minetest.add_node
local add_item = minetest.add_item
local registered_nodes = minetest.registered_nodes
local get_item_group = minetest.get_item_group
if mod_mcl_core then
minetest.register_craft({
@ -167,8 +167,8 @@ local function on_place_bucket(itemstack, user, pointed_thing, def)
local abovenode = get_node(pointed_thing.above)
local name1, name2 = undernode.name, abovenode.name
local regnode1, regnode2 = registered_nodes[name1], registered_nodes[name2]
local buildable1 = regnode1 and (regnode1.buildable_to or regnode1.groups.cauldron == 1)
local buildable2 = regnode2 and (regnode2.buildable_to or regnode2.groups.cauldron == 1)
local buildable1 = regnode1 and (regnode1.buildable_to or get_item_group(name1, "cauldron") == 1)
local buildable2 = regnode2 and (regnode2.buildable_to or get_item_group(name2, "cauldron") == 1)
if not buildable1 and not buildable2 then return itemstack end --if both nodes aren't buildable_to, skip