don't check for sticky blocks in locations that are already being pushed

This commit is contained in:
binarycat 2023-12-17 15:06:53 -05:00
parent 00359e7ae8
commit ba9b2509a0
1 changed files with 13 additions and 10 deletions

View File

@ -95,6 +95,8 @@ function mesecon.mvps_get_stack(pos, dir, maximum, all_pull_sticky)
-- position
for _, r in ipairs(mesecon.rules.alldirs) do
local adjpos = vector.add(np, r)
-- optimization: don't check blocks that are already part of the stack
if not pos_set[minetest.hash_node_position(adjpos)] then
local adjnode = minetest.get_node(adjpos)
if minetest.registered_nodes[adjnode.name]
and minetest.registered_nodes[adjnode.name].mvps_sticky then
@ -109,6 +111,7 @@ function mesecon.mvps_get_stack(pos, dir, maximum, all_pull_sticky)
end
end
end
end
if all_pull_sticky then
frontiers:add(vector.subtract(np, dir))