From 123e470544f2395ef7e06a7cf309c77c2472d128 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Thu, 16 Nov 2017 16:53:01 -0700 Subject: Add filters to prevent non-whitelisted craft items from being built --- nodes/node_builders.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'nodes/node_builders.lua') diff --git a/nodes/node_builders.lua b/nodes/node_builders.lua index 63d780c..8cc91b4 100644 --- a/nodes/node_builders.lua +++ b/nodes/node_builders.lua @@ -158,9 +158,16 @@ minetest.register_node("digtron:builder", { end, allow_metadata_inventory_put = function(pos, listname, index, stack, player) - if minetest.get_item_group(stack:get_name(), "digtron") ~= 0 then + local stack_name = stack:get_name() + + if minetest.get_item_group(stack_name, "digtron") ~= 0 then return 0 -- don't allow builders to be set to build Digtron nodes, they'll just clog the output. end + + if not minetest.registered_nodes[stack_name] and not digtron.whitelisted_on_place(stack_name) then + return 0 -- don't allow craft items unless their on_place is whitelisted. + end + local inv = minetest.get_inventory({type="node", pos=pos}) inv:set_stack(listname, index, stack:take_item(1)) return 0 -- cgit v1.2.3