From 3e12b3c7006aaae64c232834ab78b68980271060 Mon Sep 17 00:00:00 2001 From: seventeenthShulker Date: Thu, 6 Jul 2023 15:41:41 +0200 Subject: [PATCH] Check protection of certain nodes before push/pull - The node directly in front of a piston (including air) - The 'final' position of any connected nodes --- mods/ITEMS/REDSTONE/mesecons_mvps/init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua b/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua index b36721e78..d1a1171e8 100644 --- a/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua @@ -207,6 +207,11 @@ local function are_protected(nodes, player_name) end function mesecon.mvps_push(pos, dir, maximum, player_name, piston_pos) + -- check if the node in front of the piston is protected against player_name (to prevent replacing air) + if minetest.is_protected(pos, player_name) then + return false + end + return mesecon.mvps_push_or_pull(pos, dir, dir, maximum, player_name, piston_pos) end @@ -241,6 +246,9 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, player_name, if (newpos[i].x == piston_pos.x) and (newpos[i].y == piston_pos.y) and (newpos[i].z == piston_pos.z) then return end + if minetest.is_protected(newpos[i], player_name) then + return + end if not is_available(newpos[i]) then local available = false for j in ipairs(nodes) do