mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-09-26 06:10:37 +02:00
more optimization of inner loops related to mvps_push
This commit is contained in:
parent
ba9b2509a0
commit
bc9ed16c91
|
@ -98,15 +98,16 @@ function mesecon.mvps_get_stack(pos, dir, maximum, all_pull_sticky)
|
||||||
-- optimization: don't check blocks that are already part of the stack
|
-- optimization: don't check blocks that are already part of the stack
|
||||||
if not pos_set[minetest.hash_node_position(adjpos)] then
|
if not pos_set[minetest.hash_node_position(adjpos)] then
|
||||||
local adjnode = minetest.get_node(adjpos)
|
local adjnode = minetest.get_node(adjpos)
|
||||||
if minetest.registered_nodes[adjnode.name]
|
local adjdef = minetest.registered_nodes[adjnode.name]
|
||||||
and minetest.registered_nodes[adjnode.name].mvps_sticky then
|
if adjdef
|
||||||
local sticksto = minetest.registered_nodes[adjnode.name]
|
and adjdef.mvps_sticky then
|
||||||
.mvps_sticky(adjpos, adjnode)
|
local sticksto = adjdef.mvps_sticky(adjpos, adjnode)
|
||||||
|
|
||||||
-- connects to this position?
|
-- connects to this position?
|
||||||
for _, link in ipairs(sticksto) do
|
for _, link in ipairs(sticksto) do
|
||||||
if vector.equals(link, np) then
|
if vector.equals(link, np) then
|
||||||
frontiers:add(adjpos)
|
frontiers:add(adjpos)
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user