mirror of
https://github.com/minetest-mods/worldedge.git
synced 2024-12-23 08:10:21 +01:00
commit
da0fd4ca81
17
README.md
17
README.md
@ -1,20 +1,13 @@
|
|||||||
worldedge
|
worldedge
|
||||||
=========
|
=========
|
||||||
|
|
||||||
A Minetest Mod that teleports you to the other side of the map when you reach the edge.
|
A Minetest Mod that teleports you to the other side of the map when you reach its 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.
|
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.
|
You can change the worlds edge by changing the first variable in init.lua
|
||||||
|
local edge = 30000
|
||||||
|
|
||||||
local edge = 30005
|
License of code: WTFPL
|
||||||
local newedge = 30000
|
|
||||||
|
|
||||||
set edge to where you want the edge of the map to be.
|
Written by Amaz
|
||||||
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
|
Modified by Don
|
56
init.lua
56
init.lua
@ -1,40 +1,36 @@
|
|||||||
|
--------------
|
||||||
|
-- TODO: Check for terrain height
|
||||||
|
|
||||||
|
-- Defines the edge of a world
|
||||||
|
local edge = 30000
|
||||||
|
--------------
|
||||||
|
|
||||||
local count = 0
|
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)
|
minetest.register_globalstep(function(dtime)
|
||||||
count = count + dtime
|
count = count + dtime
|
||||||
if count > 5 then
|
if count < 5 then
|
||||||
count = 0
|
return
|
||||||
local players = minetest.get_connected_players()
|
end
|
||||||
for _,player in pairs(players) do
|
count = 0
|
||||||
local pos = player:getpos()
|
|
||||||
if pos.x >= edge then
|
|
||||||
player:moveto({x = -newedge, y = pos.y, z = pos.z})
|
|
||||||
end
|
|
||||||
if pos.x <= -edge then
|
|
||||||
player:moveto({x = newedge, y = pos.y, z = pos.z})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- This section is for the Y cord. It will move you from bottom to top or top to bottom of map
|
local newedge = edge - 5
|
||||||
--[[
|
-- Check if the players are near the edge and teleport them
|
||||||
if pos.y >= edge then
|
local players = minetest.get_connected_players()
|
||||||
player:moveto({x = pos.x, y = -newedge, z = pos.z})
|
for _,player in pairs(players) do
|
||||||
end
|
local pos = player:getpos()
|
||||||
if pos.y <= -edge then
|
if pos.x >= edge then
|
||||||
player:moveto({x = pos.x, y = newedge, z = pos.z})
|
player:moveto({x = -newedge, y = pos.y, z = pos.z})
|
||||||
end
|
end
|
||||||
--]]
|
if pos.x <= -edge then
|
||||||
|
player:moveto({x = newedge, y = pos.y, z = pos.z})
|
||||||
|
end
|
||||||
|
|
||||||
|
if pos.z >= edge then
|
||||||
if pos.z >= edge then
|
player:moveto({x = pos.x, y = pos.y, z = -newedge})
|
||||||
player:moveto({x = pos.x, y = pos.y, z = -newedge})
|
end
|
||||||
end
|
if pos.z <= -edge then
|
||||||
if pos.z <= -edge then
|
player:moveto({x = pos.x, y = pos.y, z = newedge})
|
||||||
player:moveto({x = pos.x, y = pos.y, z = newedge})
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user