From 077707343d867f0bddda80f7287ebf0ad84a159a Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Thu, 11 Oct 2018 21:27:22 +0100 Subject: [PATCH] protector tool checks for containers at location --- tool.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tool.lua b/tool.lua index 63189ce..0a4fe12 100644 --- a/tool.lua +++ b/tool.lua @@ -93,13 +93,12 @@ minetest.register_craftitem("protector:tool", { nod = "protector:protect2" end - -- do not replace nodes that aren't ground content e.g. chests - local nod2 = minetest.get_node(pos) - local def2 = minetest.registered_nodes[nod2.name] + -- do not replace containers with inventory space + local inv = minetest.get_inventory({type = "node", pos = pos}) - if not def2 or def2.is_ground_content ~= true then + if inv then minetest.chat_send_player(name, - "Cannot place protector, check node at " .. minetest.pos_to_string(pos)) + "Cannot place protector, container at " .. minetest.pos_to_string(pos)) return end