Prevent mobs from dying after going through portal
This commit is contained in:
parent
138f96e0b0
commit
f7e61a6e83
@ -429,6 +429,13 @@ function mob_class:on_step(dtime)
|
||||
end
|
||||
end
|
||||
|
||||
if self._just_portaled then
|
||||
self._just_portaled = self._just_portaled - dtime
|
||||
if self._just_portaled < 0 then
|
||||
self._just_portaled = nil
|
||||
end
|
||||
end
|
||||
|
||||
if update_timers(self, dtime) then return end
|
||||
|
||||
self:check_particlespawners(dtime)
|
||||
|
@ -900,15 +900,13 @@ function mob_class:falling(pos)
|
||||
return
|
||||
end
|
||||
|
||||
if mcl_portals ~= nil then
|
||||
if mcl_portals.nether_portal_cooloff(self.object) then
|
||||
return false -- mob has teleported through Nether portal - it's 99% not falling
|
||||
end
|
||||
local v = self.object:get_velocity()
|
||||
if self._just_portaled then
|
||||
self.reset_fall_damage = 1
|
||||
return false -- mob has teleported through portal - it's 99% not falling
|
||||
end
|
||||
|
||||
-- floating in water (or falling)
|
||||
local v = self.object:get_velocity()
|
||||
|
||||
if v.y > 0 then
|
||||
|
||||
-- apply gravity when moving up
|
||||
|
@ -234,6 +234,11 @@ function mcl_portals.end_teleport(obj, pos)
|
||||
end
|
||||
mcl_worlds.dimension_change(obj, mcl_worlds.pos_to_dimension(target))
|
||||
minetest.sound_play("mcl_portals_teleport", {pos=target, gain=0.5, max_hear_distance = 16}, true)
|
||||
else
|
||||
local l = obj:get_luaentity()
|
||||
if l and l.is_mob then
|
||||
l._just_portaled = 5
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -395,6 +395,11 @@ local function finalize_teleport(obj, pos, old_param2, new_param2)
|
||||
minetest.sound_play("mcl_portals_teleport", {pos = pos, gain = 0.5, max_hear_distance = 1}, true)
|
||||
mcl_worlds.dimension_change(obj)
|
||||
minetest.log("action", "[mcl_portal] " .. obj:get_player_name() .. " teleported to " .. tostring(pos))
|
||||
else
|
||||
local l = obj:get_luaentity()
|
||||
if l and l.is_mob then
|
||||
l._just_portaled = 5
|
||||
end
|
||||
end
|
||||
|
||||
teleport_finished(obj)
|
||||
|
Loading…
x
Reference in New Issue
Block a user