mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
Avoid random jumps when standing due to gravity (fewer villagers on the roofs) (#4547)
Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4547 Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land> Co-authored-by: kno10 <erich.schubert@gmail.com> Co-committed-by: kno10 <erich.schubert@gmail.com>
This commit is contained in:
parent
c34aecfcab
commit
dcfd31d17a
2 changed files with 7 additions and 6 deletions
|
@ -388,7 +388,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local function on_step_work (self, dtime)
|
local function on_step_work(self, dtime, moveresult)
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
if not pos then return end
|
if not pos then return end
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ local function on_step_work (self, dtime)
|
||||||
-- Do we abandon out of here now?
|
-- Do we abandon out of here now?
|
||||||
end
|
end
|
||||||
|
|
||||||
if self:falling(pos) then return end
|
if self:falling(pos, moveresult) then return end
|
||||||
if self:step_damage (dtime, pos) then return end
|
if self:step_damage (dtime, pos) then return end
|
||||||
|
|
||||||
if self.state == "die" then return end
|
if self.state == "die" then return end
|
||||||
|
@ -502,11 +502,11 @@ end
|
||||||
|
|
||||||
|
|
||||||
-- main mob function
|
-- main mob function
|
||||||
function mob_class:on_step(dtime)
|
function mob_class:on_step(dtime, moveresult)
|
||||||
if not DEVELOPMENT then
|
if not DEVELOPMENT then
|
||||||
-- Removed as bundled Lua (5.1 doesn't support xpcall)
|
-- Removed as bundled Lua (5.1 doesn't support xpcall)
|
||||||
--local status, retVal = xpcall(on_step_work, on_step_error_handler, self, dtime)
|
--local status, retVal = xpcall(on_step_work, on_step_error_handler, self, dtime)
|
||||||
local status, retVal = pcall(on_step_work, self, dtime)
|
local status, retVal = pcall(on_step_work, self, dtime, moveresult)
|
||||||
if status then
|
if status then
|
||||||
return retVal
|
return retVal
|
||||||
else
|
else
|
||||||
|
@ -521,7 +521,7 @@ function mob_class:on_step(dtime)
|
||||||
log_error (dump(retVal), dump(pos), dump(self))
|
log_error (dump(retVal), dump(pos), dump(self))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return on_step_work (self, dtime)
|
return on_step_work (self, dtime, moveresult)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -927,7 +927,8 @@ end
|
||||||
|
|
||||||
-- falling and fall damage
|
-- falling and fall damage
|
||||||
-- returns true if mob died
|
-- returns true if mob died
|
||||||
function mob_class:falling(pos)
|
function mob_class:falling(pos, moveresult)
|
||||||
|
if moveresult and moveresult.touching_ground then return false end
|
||||||
|
|
||||||
if self.fly and self.state ~= "die" then
|
if self.fly and self.state ~= "die" then
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue