From 7ae983b66901cc5f58a8d48e33d01c4b8b1836a3 Mon Sep 17 00:00:00 2001 From: auouymous <5005204+auouymous@users.noreply.github.com> Date: Tue, 8 Dec 2020 14:20:16 -0700 Subject: [PATCH] Don't replace protected liquids with bones (#2790) --- mods/bones/init.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/mods/bones/init.lua b/mods/bones/init.lua index 5e542593..34f010c2 100644 --- a/mods/bones/init.lua +++ b/mods/bones/init.lua @@ -141,8 +141,18 @@ local function may_replace(pos, player) return false end - -- allow replacing air and liquids - if node_name == "air" or node_definition.liquidtype ~= "none" then + -- allow replacing air + if node_name == "air" then + return true + end + + -- don't replace nodes inside protections + if minetest.is_protected(pos, player:get_player_name()) then + return false + end + + -- allow replacing liquids + if node_definition.liquidtype ~= "none" then return true end @@ -154,8 +164,7 @@ local function may_replace(pos, player) -- default to each nodes buildable_to; if a placed block would replace it, why shouldn't bones? -- flowers being squished by bones are more realistical than a squished stone, too - -- exception are of course any protected buildable_to - return node_definition.buildable_to and not minetest.is_protected(pos, player:get_player_name()) + return node_definition.buildable_to end local drop = function(pos, itemstack)