diff options
author | SmallJoker <st.rentsch@hotmail.com> | 2014-07-24 11:51:07 +0200 |
---|---|---|
committer | BlockMen <nmuelll@web.de> | 2014-09-28 13:33:39 +0200 |
commit | db5aff832ba929c567564bfd9ee7bb6d7ef03a05 (patch) | |
tree | 8059854f0f83079adee744aa524cc489e7c1ad75 /builtin | |
parent | 61ed56f916f71a708b56260d7cba2160e8166529 (diff) | |
download | minetest-db5aff832ba929c567564bfd9ee7bb6d7ef03a05.tar.gz minetest-db5aff832ba929c567564bfd9ee7bb6d7ef03a05.tar.bz2 minetest-db5aff832ba929c567564bfd9ee7bb6d7ef03a05.zip |
Use round if falling node is misplaced
Fixes: http://i.imgur.com/arAWw1i.png (middle-right)
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/game/falling.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index 8f3b41d5a..0e45a4375 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -43,7 +43,6 @@ core.register_entity(":__builtin:falling_node", { on_activate = function(self, staticdata) self.object:set_armor_groups({immortal=1}) - --self.object:setacceleration({x=0, y=-10, z=0}) self:set_node({name=staticdata}) end, @@ -102,8 +101,12 @@ core.register_entity(":__builtin:falling_node", { core.add_node(np, self.node) self.object:remove() nodeupdate(np) - else - -- Do nothing + return + 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 }) @@ -175,7 +178,7 @@ function nodeupdate_single(p, delay) if delay then core.after(0.1, nodeupdate_single, {x=p.x, y=p.y, z=p.z}, false) else - n.level = core.env:get_node_level(p) + n.level = core.get_node_level(p) core.remove_node(p) spawn_falling_node(p, n) nodeupdate(p) |