From e7d11b3c381335e0dab3ac0cc3ac898ca6b9a4a5 Mon Sep 17 00:00:00 2001 From: binarycat Date: Sat, 16 Dec 2023 16:33:36 -0500 Subject: [PATCH] fix issue 645 --- mesecons_pistons/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua index 3d75b35..9fa26c5 100644 --- a/mesecons_pistons/init.lua +++ b/mesecons_pistons/init.lua @@ -84,7 +84,16 @@ local piston_on = function(pos, node) local pistonspec = get_pistonspec(node.name, "offname") local dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1) local pusher_pos = vector.add(pos, dir) + local behind_pos = vector.subtract(pos, dir) local meta = minetest.get_meta(pos) + -- NOTE: this gets calculated twice, but fixing this would mean changing the public api. + local stack = mesecon.mvps_get_stack(pusher_pos, dir, max_push, meta:get_string("owner")) + for _, n in ipairs(stack) do + -- fix issue 645 + if vector.equals(n.pos, behind_pos) then + return + end + end local success, stack, oldstack = mesecon.mvps_push(pusher_pos, dir, max_push, meta:get_string("owner")) if not success then if stack == "protected" then