From 3e3e9f39314e1b852c136436f912bf90b4aa0e63 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 17 Aug 2017 04:21:59 +0200 Subject: [PATCH] Fix player pos detection in portals --- mods/MAPGEN/mcl_portals/portal_end.lua | 3 +++ mods/MAPGEN/mcl_portals/portal_nether.lua | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mods/MAPGEN/mcl_portals/portal_end.lua b/mods/MAPGEN/mcl_portals/portal_end.lua index 81c2aad6f2..75ef9415fc 100644 --- a/mods/MAPGEN/mcl_portals/portal_end.lua +++ b/mods/MAPGEN/mcl_portals/portal_end.lua @@ -331,6 +331,9 @@ minetest.register_abm({ -- teleport the player minetest.after(3, function(obj, pos, target3) 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 minetest.get_node(objpos).name ~= "mcl_portals:portal_end" then return diff --git a/mods/MAPGEN/mcl_portals/portal_nether.lua b/mods/MAPGEN/mcl_portals/portal_nether.lua index 09ac74c42a..e99cace5f7 100644 --- a/mods/MAPGEN/mcl_portals/portal_nether.lua +++ b/mods/MAPGEN/mcl_portals/portal_nether.lua @@ -344,7 +344,14 @@ minetest.register_abm({ end -- teleport the player 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 return end