Update init.lua

This commit is contained in:
ㄗㄠˋ ㄑㄧˊ 2020-01-08 14:15:59 +08:00 committed by GitHub
parent 5645fe5209
commit 3e2152a59e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -295,8 +295,11 @@ minetest.register_abm({
vector.subtract(target, 4), vector.add(target, 4)) vector.subtract(target, 4), vector.add(target, 4))
end end
-- teleport the player -- teleport the player
minetest.after(3, function(o, p, t) pcall(function() -- avoid crashes when players exit minetest.after(3, function(o, p, t) function()
local objpos = o:getpos() local objpos = o:getpos()
if not objpos then -- player not exist
return
end
objpos.y = objpos.y + 0.1 -- Fix some glitches at -8000 objpos.y = objpos.y + 0.1 -- Fix some glitches at -8000
if minetest.get_node(objpos).name ~= "nether:portal" then if minetest.get_node(objpos).name ~= "nether:portal" then
return return
@ -317,7 +320,7 @@ minetest.register_abm({
minetest.after(1, check_and_build_portal, p, t) minetest.after(1, check_and_build_portal, p, t)
end) end, obj, pos, target) end, obj, pos, target)
end end
end end
end end