mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-26 18:09:33 +01:00
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
This commit is contained in:
parent
0637182697
commit
3e12b3c700
1 changed files with 8 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue