1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2024-12-25 18:20:20 +01:00

gravity is a bummer

This commit is contained in:
TenPlus1 2017-07-02 18:47:11 +01:00
parent a964aa028d
commit a9178b3cb2

13
api.lua
View File

@ -1943,9 +1943,18 @@ local falling = function(self, pos)
-- floating in water (or falling) -- floating in water (or falling)
local v = self.object:getvelocity() local v = self.object:getvelocity()
if v.y > self.fall_speed then if v.y > 0 then
-- fall downwards -- apply gravity when moving up
self.object:setacceleration({
x = 0,
y = -10,
z = 0
})
elseif v.y <= 0 and v.y > self.fall_speed then
-- fall downwards at set speed
self.object:setacceleration({ self.object:setacceleration({
x = 0, x = 0,
y = self.fall_speed, y = self.fall_speed,