diff options
author | Rui <Rui914@users.noreply.github.com> | 2016-03-24 12:20:00 +0900 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2016-03-25 15:19:39 +0100 |
commit | c3f6cdcd54fa4b0e1b4a21e9075695f98a97a454 (patch) | |
tree | 1fef355a10d5bb8384eca1f70fa981169a771a34 | |
parent | 0fde86dd93d77ad3ff2662a049eeb90ad432575e (diff) | |
download | minetest-c3f6cdcd54fa4b0e1b4a21e9075695f98a97a454.tar.gz minetest-c3f6cdcd54fa4b0e1b4a21e9075695f98a97a454.tar.bz2 minetest-c3f6cdcd54fa4b0e1b4a21e9075695f98a97a454.zip |
Falling: Set acceleration on step again
Commit
65c09a96f41705bb8e75fc5ff4276342be91ed11 "Set acceleration only once in falling node"
has made the acceleration being set only once.
But this has introduced a regression.
Fix #3884.
-rw-r--r-- | builtin/game/falling.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index 6282f6558..29d94ae5e 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -30,8 +30,6 @@ core.register_entity(":__builtin:falling_node", { end, on_activate = function(self, staticdata) - -- Set gravity - self.object:setacceleration({x = 0, y = -10, z = 0}) self.object:set_armor_groups({immortal = 1}) local node = core.deserialize(staticdata) @@ -43,6 +41,11 @@ core.register_entity(":__builtin:falling_node", { end, on_step = function(self, dtime) + -- Set gravity + local acceleration = self.object:getacceleration() + if not vector.equals(acceleration, {x = 0, y = -10, z = 0}) then + self.object:setacceleration({x = 0, y = -10, z = 0}) + end -- Turn to actual sand when collides to ground or just move local pos = self.object:getpos() local bcp = {x = pos.x, y = pos.y - 0.7, z = pos.z} -- Position of bottom center point |