forked from MineClone5/MineClone5
Fix #700
This commit is contained in:
parent
034174390d
commit
3787b95e0f
|
@ -248,12 +248,11 @@ minetest.register_abm({
|
|||
if dim == "end" then
|
||||
-- End portal in the End:
|
||||
-- Teleport back to the player's spawn or world spawn in the Overworld.
|
||||
|
||||
if obj:is_player() then
|
||||
target = mcl_spawn.get_spawn_pos(obj)
|
||||
else
|
||||
target = mcl_spawn.get_world_spawn_pos(obj)
|
||||
_, target = mcl_spawn.spawn(obj)
|
||||
end
|
||||
|
||||
target = target or mcl_spawn.get_world_spawn_pos(obj)
|
||||
else
|
||||
-- End portal in any other dimension:
|
||||
-- Teleport to the End at a fixed position and generate a
|
||||
|
@ -287,6 +286,7 @@ minetest.register_abm({
|
|||
|
||||
-- Teleport
|
||||
obj:set_pos(target)
|
||||
|
||||
if obj:is_player() then
|
||||
-- Look towards the main End island
|
||||
if dim ~= "end" then
|
||||
|
|
|
@ -122,8 +122,7 @@ local function good_for_respawn(pos)
|
|||
(def1.damage_per_second == nil or def2.damage_per_second <= 0)
|
||||
end
|
||||
|
||||
-- Respawn player at specified respawn position
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
mcl_spawn.spawn = function(player)
|
||||
local pos, custom_spawn = mcl_spawn.get_spawn_pos(player)
|
||||
if pos and custom_spawn then
|
||||
-- Check if bed is still there
|
||||
|
@ -155,12 +154,14 @@ minetest.register_on_respawnplayer(function(player)
|
|||
local spawn_pos = vector.add(pos, offset)
|
||||
if good_for_respawn(spawn_pos) then
|
||||
player:set_pos(spawn_pos)
|
||||
return true
|
||||
return true, spawn_pos
|
||||
end
|
||||
end
|
||||
|
||||
-- We here if we didn't find suitable place for respawn:
|
||||
return false
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Respawn player at specified respawn position
|
||||
minetest.register_on_respawnplayer(mcl_spawn.spawn)
|
||||
|
|
Loading…
Reference in New Issue