diff --git a/README.md b/README.md index 199a336..aaee28b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,20 @@ worldedge ========= -A Minetest Mod +A Minetest Mod that teleports you to the other side of the map when you reach the edge. + +This mod makes it so when a player reaches the edge of the world they are teleported to the other side of the map. +This gives the illusion that that world is round and you can walk all the way around. + +You can change the worlds edge by changing 2 numbers at the top of init.lua. + +local edge = 30005 +local newedge = 30000 + +set edge to where you want the edge of the map to be. +newedge sets where player teleports to. it needs to be less than edge by at least 1 block. + +This mod is licenced as WTFPL + +Writen by Amaz +Modified by Don diff --git a/README.md~ b/README.md~ new file mode 100644 index 0000000..199a336 --- /dev/null +++ b/README.md~ @@ -0,0 +1,4 @@ +worldedge +========= + +A Minetest Mod diff --git a/init.lua b/init.lua index a77359d..7c42aba 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,8 @@ ---[[ + local count = 0 +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 minetest.register_globalstep(function(dtime) count = count + dtime if count > 5 then @@ -8,59 +10,32 @@ minetest.register_globalstep(function(dtime) local players = minetest.get_connected_players() for _,player in pairs(players) do local pos = player:getpos() - if pos.x >= 30850 then - player:moveto({x = -30800, y = pos.y, z = pos.z}) + if pos.x >= edge then + player:moveto({x = -newedge, y = pos.y, z = pos.z}) end - if pos.x <= -30850 then - player:moveto({x = 30800, y = pos.y, z = pos.z}) + if pos.x <= -edge then + player:moveto({x = newedge, y = pos.y, z = pos.z}) end - - if pos.y >= 30850 then - player:moveto({x = pos.x, y = -30800, z = pos.z}) + +-- 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}) end - if pos.y <= -30850 then - player:moveto({x = pos.x, y = 30800, z = pos.z}) + if pos.y <= -edge then + player:moveto({x = pos.x, y = newedge, z = pos.z}) end - - if pos.z >= 30850 then - player:moveto({x = pos.x, y = pos.y, z = -30800}) - end - if pos.z <= -30850 then - player:moveto({x = pos.x, y = pos.y, z = 30800}) - end - end - end -end) --]] -local count = 0 -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() - if pos.x >= 100 then - player:moveto({x = -100, y = pos.y, z = pos.z}) - end - if pos.x <= -100 then - player:moveto({x = 100, y = pos.y, z = pos.z}) - end - --[[if pos.y >= 30850 then - player:moveto({x = pos.x, y = -30800, z = pos.z}) + if pos.z >= edge then + player:moveto({x = pos.x, y = pos.y, z = -newedge}) end - if pos.y <= -30850 then - player:moveto({x = pos.x, y = 30800, z = pos.z}) - end--]] - - if pos.z >= 100 then - player:moveto({x = pos.x, y = pos.y, z = -100}) - end - if pos.z <= -100 then - player:moveto({x = pos.x, y = pos.y, z = 100}) + if pos.z <= -edge then + player:moveto({x = pos.x, y = pos.y, z = newedge}) end end end end) + +