From: Rui Date: Thu, 24 Mar 2016 03:20:00 +0000 (+0900) Subject: Falling: Set acceleration on step again X-Git-Tag: 0.4.14~134 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c3f6cdcd54fa4b0e1b4a21e9075695f98a97a454;p=oweals%2Fminetest.git 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. --- 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