From 491818fc03d2cfc4ac0b555ec5e00b0e9477339f Mon Sep 17 00:00:00 2001 From: luk3yx Date: Sat, 16 Apr 2022 16:46:19 +1200 Subject: [PATCH] Don't allow protector blocks to replace other nodes --- protector.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/protector.lua b/protector.lua index f8705e8..b28f8a7 100644 --- a/protector.lua +++ b/protector.lua @@ -28,6 +28,13 @@ minetest.register_node("areas:protector", { local name = player and player:get_player_name() if not name or not minetest.is_protected(pos, name) then + -- Don't replace nodes that aren't buildable to + local old_node = minetest.get_node(pos) + local def = minetest.registered_nodes[old_node.name] + if not def or not def.buildable_to then + return itemstack + end + local pos1 = vadd(pos, vnew(radius, radius, radius)) local pos2 = vadd(pos, vnew(-radius, -radius, -radius)) local perm, err = areas:canPlayerAddArea(pos1, pos2, name)