mirror of
https://github.com/moparisthebest/minetest
synced 2024-11-17 14:55:13 -05:00
Only enqueue falling nodes if they really want to fall
This commit is contained in:
parent
1586cdac53
commit
97f0bb0342
@ -142,7 +142,7 @@ end
|
|||||||
-- Some common functions
|
-- Some common functions
|
||||||
--
|
--
|
||||||
|
|
||||||
function nodeupdate_single(p)
|
function nodeupdate_single(p, delay)
|
||||||
n = minetest.env:get_node(p)
|
n = minetest.env:get_node(p)
|
||||||
if minetest.get_node_group(n.name, "falling_node") ~= 0 then
|
if minetest.get_node_group(n.name, "falling_node") ~= 0 then
|
||||||
p_bottom = {x=p.x, y=p.y-1, z=p.z}
|
p_bottom = {x=p.x, y=p.y-1, z=p.z}
|
||||||
@ -151,11 +151,15 @@ function nodeupdate_single(p)
|
|||||||
if minetest.registered_nodes[n_bottom.name] and
|
if minetest.registered_nodes[n_bottom.name] and
|
||||||
(not minetest.registered_nodes[n_bottom.name].walkable or
|
(not minetest.registered_nodes[n_bottom.name].walkable or
|
||||||
minetest.registered_nodes[n_bottom.name].buildable_to) then
|
minetest.registered_nodes[n_bottom.name].buildable_to) then
|
||||||
|
if delay then
|
||||||
|
minetest.after(0.1, nodeupdate_single, {x=p.x, y=p.y, z=p.z}, false)
|
||||||
|
else
|
||||||
minetest.env:remove_node(p)
|
minetest.env:remove_node(p)
|
||||||
spawn_falling_node(p, n.name)
|
spawn_falling_node(p, n.name)
|
||||||
nodeupdate(p)
|
nodeupdate(p)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if minetest.get_node_group(n.name, "attached_node") ~= 0 then
|
if minetest.get_node_group(n.name, "attached_node") ~= 0 then
|
||||||
if not check_attached_node(p, n) then
|
if not check_attached_node(p, n) then
|
||||||
@ -170,14 +174,11 @@ function nodeupdate(p)
|
|||||||
p.x = math.floor(p.x+0.5)
|
p.x = math.floor(p.x+0.5)
|
||||||
p.y = math.floor(p.y+0.5)
|
p.y = math.floor(p.y+0.5)
|
||||||
p.z = math.floor(p.z+0.5)
|
p.z = math.floor(p.z+0.5)
|
||||||
nodeupdate_single(p)
|
|
||||||
|
|
||||||
for x = -1,1 do
|
for x = -1,1 do
|
||||||
for y = -1,1 do
|
for y = -1,1 do
|
||||||
for z = -1,1 do
|
for z = -1,1 do
|
||||||
if not (x==0 and y==0 and z==0) then
|
nodeupdate_single({x=p.x+x, y=p.y+y, z=p.z+z}, not (x==0 and y==0 and z==0))
|
||||||
minetest.after(0.1, nodeupdate_single, {x=p.x+x, y=p.y+y, z=p.z+z})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user