mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-26 11:17:30 +01:00
Fix more self object references in falling
This commit is contained in:
parent
15560d969c
commit
32be8f9602
@ -871,9 +871,8 @@ function mob_class:falling(pos)
|
|||||||
|
|
||||||
-- floating in water (or falling)
|
-- floating in water (or falling)
|
||||||
local v = self.object:get_velocity()
|
local v = self.object:get_velocity()
|
||||||
|
if v then
|
||||||
if v.y > 0 then
|
if v.y > 0 then
|
||||||
|
|
||||||
-- apply gravity when moving up
|
-- apply gravity when moving up
|
||||||
self.object:set_acceleration({
|
self.object:set_acceleration({
|
||||||
x = 0,
|
x = 0,
|
||||||
@ -882,7 +881,6 @@ function mob_class:falling(pos)
|
|||||||
})
|
})
|
||||||
|
|
||||||
elseif v.y <= 0 and v.y > self.fall_speed then
|
elseif v.y <= 0 and v.y > self.fall_speed then
|
||||||
|
|
||||||
-- fall downwards at set speed
|
-- fall downwards at set speed
|
||||||
self.object:set_acceleration({
|
self.object:set_acceleration({
|
||||||
x = 0,
|
x = 0,
|
||||||
@ -893,11 +891,12 @@ function mob_class:falling(pos)
|
|||||||
-- stop accelerating once max fall speed hit
|
-- stop accelerating once max fall speed hit
|
||||||
self.object:set_acceleration({x = 0, y = 0, z = 0})
|
self.object:set_acceleration({x = 0, y = 0, z = 0})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local acc = self.object:get_acceleration()
|
||||||
|
|
||||||
if minetest.registered_nodes[node_ok(pos).name].groups.lava then
|
if minetest.registered_nodes[node_ok(pos).name].groups.lava then
|
||||||
|
if acc and self.floats_on_lava == 1 then
|
||||||
if self.floats_on_lava == 1 then
|
|
||||||
|
|
||||||
self.object:set_acceleration({
|
self.object:set_acceleration({
|
||||||
x = 0,
|
x = 0,
|
||||||
y = -self.fall_speed / (math.max(1, v.y) ^ 2),
|
y = -self.fall_speed / (math.max(1, v.y) ^ 2),
|
||||||
@ -908,9 +907,7 @@ function mob_class:falling(pos)
|
|||||||
|
|
||||||
-- in water then float up
|
-- in water then float up
|
||||||
if minetest.registered_nodes[node_ok(pos).name].groups.water then
|
if minetest.registered_nodes[node_ok(pos).name].groups.water then
|
||||||
|
if acc and self.floats == 1 then
|
||||||
if self.floats == 1 then
|
|
||||||
|
|
||||||
self.object:set_acceleration({
|
self.object:set_acceleration({
|
||||||
x = 0,
|
x = 0,
|
||||||
y = -self.fall_speed / (math.max(1, v.y) ^ 2),
|
y = -self.fall_speed / (math.max(1, v.y) ^ 2),
|
||||||
@ -918,10 +915,8 @@ function mob_class:falling(pos)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
||||||
-- fall damage onto solid ground
|
-- fall damage onto solid ground
|
||||||
if self.fall_damage == 1
|
if self.fall_damage == 1 and self.object:get_velocity().y == 0 then
|
||||||
and self.object:get_velocity().y == 0 then
|
|
||||||
local n = node_ok(vector.offset(pos,0,-1,0)).name
|
local n = node_ok(vector.offset(pos,0,-1,0)).name
|
||||||
local d = (self.old_y or 0) - self.object:get_pos().y
|
local d = (self.old_y or 0) - self.object:get_pos().y
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user