Falling: Set acceleration on step again

Commit

65c09a96f4 "Set acceleration only once in falling node"

has made the acceleration being set only once.
But this has introduced a regression.

Fix #3884.
This commit is contained in:
Rui 2016-03-24 12:20:00 +09:00 committed by est31
parent 0fde86dd93
commit c3f6cdcd54
1 changed files with 5 additions and 2 deletions

View File

@ -30,8 +30,6 @@ core.register_entity(":__builtin:falling_node", {
end, end,
on_activate = function(self, staticdata) on_activate = function(self, staticdata)
-- Set gravity
self.object:setacceleration({x = 0, y = -10, z = 0})
self.object:set_armor_groups({immortal = 1}) self.object:set_armor_groups({immortal = 1})
local node = core.deserialize(staticdata) local node = core.deserialize(staticdata)
@ -43,6 +41,11 @@ core.register_entity(":__builtin:falling_node", {
end, end,
on_step = function(self, dtime) 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 -- Turn to actual sand when collides to ground or just move
local pos = self.object:getpos() local pos = self.object:getpos()
local bcp = {x = pos.x, y = pos.y - 0.7, z = pos.z} -- Position of bottom center point local bcp = {x = pos.x, y = pos.y - 0.7, z = pos.z} -- Position of bottom center point