From c3f6cdcd54fa4b0e1b4a21e9075695f98a97a454 Mon Sep 17 00:00:00 2001
From: Rui <Rui914@users.noreply.github.com>
Date: Thu, 24 Mar 2016 12:20:00 +0900
Subject: [PATCH] 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.
---
 builtin/game/falling.lua | 7 +++++--
 1 file 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
-- 
GitLab