Fix player pos detection in portals

This commit is contained in:
Wuzzy 2017-08-17 04:21:59 +02:00
parent 817c52f92f
commit 3e3e9f3931
2 changed files with 11 additions and 1 deletions

View File

@ -331,6 +331,9 @@ minetest.register_abm({
-- teleport the player -- teleport the player
minetest.after(3, function(obj, pos, target3) minetest.after(3, function(obj, pos, target3)
local objpos = obj:getpos() local objpos = obj:getpos()
-- If player stands, player is at ca. something+0.5
-- which might cause precision problems, so we used ceil.
objpos.y = math.ceil(objpos.y)
if objpos == nil then return end --maikerumine added for objects to travel if objpos == nil then return end --maikerumine added for objects to travel
if minetest.get_node(objpos).name ~= "mcl_portals:portal_end" then if minetest.get_node(objpos).name ~= "mcl_portals:portal_end" then
return return

View File

@ -344,7 +344,14 @@ minetest.register_abm({
end end
-- teleport the player -- teleport the player
minetest.after(3, function(obj, pos, target) minetest.after(3, function(obj, pos, target)
local objpos = obj:getpos() if objpos == nil then return end --maikerumine added for objects to travel local objpos = obj:getpos()
if objpos == nil then
return
end
-- If player stands, player is at ca. something+0.5
-- which might cause precision problems, so we used ceil.
objpos.y = math.ceil(objpos.y)
if minetest.get_node(objpos).name ~= "mcl_portals:portal" then if minetest.get_node(objpos).name ~= "mcl_portals:portal" then
return return
end end