protector tool checks for containers at location
This commit is contained in:
parent
4e81345b81
commit
077707343d
1 changed files with 4 additions and 5 deletions
9
tool.lua
9
tool.lua
|
|
@ -93,13 +93,12 @@ minetest.register_craftitem("protector:tool", {
|
||||||
nod = "protector:protect2"
|
nod = "protector:protect2"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- do not replace nodes that aren't ground content e.g. chests
|
-- do not replace containers with inventory space
|
||||||
local nod2 = minetest.get_node(pos)
|
local inv = minetest.get_inventory({type = "node", pos = pos})
|
||||||
local def2 = minetest.registered_nodes[nod2.name]
|
|
||||||
|
|
||||||
if not def2 or def2.is_ground_content ~= true then
|
if inv then
|
||||||
minetest.chat_send_player(name,
|
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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue