mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Use round if falling node is misplaced
Fixes: http://i.imgur.com/arAWw1i.png (middle-right)
This commit is contained in:
parent
61ed56f916
commit
db5aff832b
@ -43,7 +43,6 @@ core.register_entity(":__builtin:falling_node", {
|
|||||||
|
|
||||||
on_activate = function(self, staticdata)
|
on_activate = function(self, staticdata)
|
||||||
self.object:set_armor_groups({immortal=1})
|
self.object:set_armor_groups({immortal=1})
|
||||||
--self.object:setacceleration({x=0, y=-10, z=0})
|
|
||||||
self:set_node({name=staticdata})
|
self:set_node({name=staticdata})
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -102,8 +101,12 @@ core.register_entity(":__builtin:falling_node", {
|
|||||||
core.add_node(np, self.node)
|
core.add_node(np, self.node)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
nodeupdate(np)
|
nodeupdate(np)
|
||||||
else
|
return
|
||||||
-- Do nothing
|
end
|
||||||
|
local vel = self.object:getvelocity()
|
||||||
|
if vector.equals(vel, {x=0,y=0,z=0}) then
|
||||||
|
local npos = self.object:getpos()
|
||||||
|
self.object:setpos(vector.round(npos))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -175,7 +178,7 @@ function nodeupdate_single(p, delay)
|
|||||||
if delay then
|
if delay then
|
||||||
core.after(0.1, nodeupdate_single, {x=p.x, y=p.y, z=p.z}, false)
|
core.after(0.1, nodeupdate_single, {x=p.x, y=p.y, z=p.z}, false)
|
||||||
else
|
else
|
||||||
n.level = core.env:get_node_level(p)
|
n.level = core.get_node_level(p)
|
||||||
core.remove_node(p)
|
core.remove_node(p)
|
||||||
spawn_falling_node(p, n)
|
spawn_falling_node(p, n)
|
||||||
nodeupdate(p)
|
nodeupdate(p)
|
||||||
|
Loading…
Reference in New Issue
Block a user