1
0
Fork 0

Fix self object checks for check suspend

hardcore_mode_test
ancientmarinerdev 2023-01-23 01:44:52 +00:00 committed by Gitea
parent af86e73280
commit e4f26a4688
1 changed files with 14 additions and 9 deletions

View File

@ -987,17 +987,22 @@ function mob_class:check_dying()
end end
function mob_class:check_suspend() function mob_class:check_suspend()
if not self:player_in_active_range() then local pos = self.object:get_pos()
local pos = self.object:get_pos()
if pos and not self:player_in_active_range() then
local node_under = node_ok(vector.offset(pos,0,-1,0)).name local node_under = node_ok(vector.offset(pos,0,-1,0)).name
local acc = self.object:get_acceleration()
self:set_animation( "stand", true) self:set_animation( "stand", true)
if acc.y > 0 or node_under ~= "air" then
self.object:set_acceleration(vector.new(0,0,0)) local acc = self.object:get_acceleration()
self.object:set_velocity(vector.new(0,0,0)) if acc then
end if acc.y > 0 or node_under ~= "air" then
if acc.y == 0 and node_under == "air" then self.object:set_acceleration(vector.new(0,0,0))
self:falling(pos) self.object:set_velocity(vector.new(0,0,0))
end
if acc.y == 0 and node_under == "air" then
self:falling(pos)
end
end end
return true return true
end end