From 29689c63355faed8472f2af8b7b9e94791983e2a Mon Sep 17 00:00:00 2001 From: Milan2018 Date: Thu, 10 Sep 2020 19:04:15 +0200 Subject: [PATCH] =?UTF-8?q?Aktualizovat=20=E2=80=9Emesecons/mesecons=5Fmvp?= =?UTF-8?q?s/init.lua=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mesecons/mesecons_mvps/init.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mesecons/mesecons_mvps/init.lua b/mesecons/mesecons_mvps/init.lua index 4aa62d9..3dc9e28 100644 --- a/mesecons/mesecons_mvps/init.lua +++ b/mesecons/mesecons_mvps/init.lua @@ -135,29 +135,31 @@ function mesecon.mvps_get_stack(pos, dir, maximum, all_pull_sticky) return nodes end -function mesecon.mvps_push(pos, dir, maximum) - return mesecon.mvps_push_or_pull(pos, dir, dir, maximum) +function mesecon.mvps_push(pos, dir, maximum, owner) + return mesecon.mvps_push_or_pull(pos, dir, dir, maximum, nil, owner) end -function mesecon.mvps_pull_all(pos, dir, maximum) - return mesecon.mvps_push_or_pull(pos, vector.multiply(dir, -1), dir, maximum, true) +function mesecon.mvps_pull_all(pos, dir, maximum, owner) + return mesecon.mvps_push_or_pull(pos, vector.multiply(dir, -1), dir, maximum, true, owner) end -function mesecon.mvps_pull_single(pos, dir, maximum) - return mesecon.mvps_push_or_pull(pos, vector.multiply(dir, -1), dir, maximum) +function mesecon.mvps_pull_single(pos, dir, maximum, owner) + return mesecon.mvps_push_or_pull(pos, vector.multiply(dir, -1), dir, maximum, nil, owner) end -- pos: pos of mvps; stackdir: direction of building the stack -- movedir: direction of actual movement -- maximum: maximum nodes to be pushed -- all_pull_sticky: All nodes are sticky in the direction that they are pulled from -function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sticky) +function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sticky, owner) + local owner = tostring(owner ~= "" and owner or "mvps") local nodes = mesecon.mvps_get_stack(pos, movedir, maximum, all_pull_sticky) if not nodes then return end -- determine if one of the nodes blocks the push / pull for id, n in ipairs(nodes) do - if mesecon.is_mvps_stopper(n.node, movedir, nodes, id) or minetest.is_protected(n.pos, "mvps") then + if mesecon.is_mvps_stopper(n.node, movedir, nodes, id) + or minetest.is_protected(n.pos, owner) then return end end