worldedge/init.lua

42 lines
1.2 KiB
Lua
Raw Normal View History

2014-12-14 15:25:47 +01:00
2014-12-14 15:52:09 +01:00
2014-12-14 15:25:47 +01:00
local count = 0
2014-12-14 15:52:09 +01:00
local edge = 30000 --sets the edge of map
local newedge = 29995 --sets the other side where player teleports to. Should be a few blocks less than edge
2014-12-14 15:25:47 +01:00
minetest.register_globalstep(function(dtime)
count = count + dtime
if count > 5 then
count = 0
local players = minetest.get_connected_players()
for _,player in pairs(players) do
local pos = player:getpos()
2014-12-14 15:52:09 +01:00
if pos.x >= edge then
player:moveto({x = -newedge, y = pos.y, z = pos.z})
2014-12-14 15:25:47 +01:00
end
2014-12-14 15:52:09 +01:00
if pos.x <= -edge then
player:moveto({x = newedge, y = pos.y, z = pos.z})
2014-12-14 15:25:47 +01:00
end
2014-12-14 15:52:09 +01:00
-- This section is for the Y cord. It will move you from bottom to top or top to bottom of map
--[[
if pos.y >= edge then
player:moveto({x = pos.x, y = -newedge, z = pos.z})
2014-12-14 15:25:47 +01:00
end
2014-12-14 15:52:09 +01:00
if pos.y <= -edge then
player:moveto({x = pos.x, y = newedge, z = pos.z})
2014-12-14 15:25:47 +01:00
end
--]]
2014-12-14 15:52:09 +01:00
if pos.z >= edge then
player:moveto({x = pos.x, y = pos.y, z = -newedge})
2014-12-14 15:25:47 +01:00
end
2014-12-14 15:52:09 +01:00
if pos.z <= -edge then
player:moveto({x = pos.x, y = pos.y, z = newedge})
2014-12-14 15:25:47 +01:00
end
end
end
end)
2014-12-14 15:52:09 +01:00