Sort of fixed the multiple teleportation issue. The rest of this issue is a bug in minetest

This commit is contained in:
Joel Leclerc 2012-04-18 17:49:27 -06:00
parent 414cc39999
commit 4c98df1b07
2 changed files with 16 additions and 5 deletions

View File

@ -786,9 +786,14 @@ minetest.register_abm({
local objs = minetest.env:get_objects_inside_radius(pos, 1) local objs = minetest.env:get_objects_inside_radius(pos, 1)
if objs[1] ~= nil then if objs[1] ~= nil then
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
local objpos=obj:getpos() local objpos = obj:getpos()
local objmeta = minetest.env:get_meta(objpos)
if objpos.y>pos.y-1 and objpos.y<pos.y and obj:get_player_name() ~= nil and obj:get_player_name() ~= "" then if objpos.y>pos.y-1 and objpos.y<pos.y and obj:get_player_name() ~= nil and obj:get_player_name() ~= "" then
nether:teleport_player(nether:inside_nether(obj:getpos()), obj) if objmeta:get_string("teleporting") == "" or objmeta:get_string("teleporting") == nil then
objmeta:set_string("teleporting", "true")
nether:teleport_player(nether:inside_nether(obj:getpos()), obj)
objmeta:set_string("teleporting", "")
end
end end
end end
end end

View File

@ -532,7 +532,7 @@ function table_count(tt, item)
end end
-- Remove duplicates from table -- Remove duplicate positions from table
function table_unique(tt) function table_unique(tt)
local newtable local newtable
newtable = {} newtable = {}
@ -726,6 +726,7 @@ function nether:teleport_player(from_nether, player)
teleportpos = {x=portalpos.x + coin2, y=portalpos.y + 1, z=portalpos.z + coin} teleportpos = {x=portalpos.x + coin2, y=portalpos.y + 1, z=portalpos.z + coin}
end end
player:setpos(teleportpos) player:setpos(teleportpos)
objmeta:set_string("teleporting", "")
end end
-- Portal Creator -- Portal Creator
@ -786,9 +787,14 @@ minetest.register_abm({
local objs = minetest.env:get_objects_inside_radius(pos, 1) local objs = minetest.env:get_objects_inside_radius(pos, 1)
if objs[1] ~= nil then if objs[1] ~= nil then
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
local objpos=obj:getpos() local objpos = obj:getpos()
local objmeta = minetest.env:get_meta(objpos)
if objpos.y>pos.y-1 and objpos.y<pos.y and obj:get_player_name() ~= nil and obj:get_player_name() ~= "" then if objpos.y>pos.y-1 and objpos.y<pos.y and obj:get_player_name() ~= nil and obj:get_player_name() ~= "" then
nether:teleport_player(nether:inside_nether(obj:getpos()), obj) if objmeta:get_string("teleporting") == "" or objmeta:get_string("teleporting") == nil then
objmeta:set_string("teleporting", "true")
nether:teleport_player(nether:inside_nether(obj:getpos()), obj)
objmeta:set_string("teleporting", "")
end
end end
end end
end end