Skip to content

Commit

Permalink
Falling: Set acceleration on step again
Browse files Browse the repository at this point in the history
Commit

65c09a9 "Set acceleration only once in falling node"

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

Fix #3884.
  • Loading branch information
Rui authored and est31 committed Mar 25, 2016
1 parent 0fde86d commit c3f6cdc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions builtin/game/falling.lua
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit c3f6cdc

Please sign in to comment.