Allow to teleport back to overworld

This commit is contained in:
Wuzzy 2017-08-17 01:58:17 +02:00
parent 54dc6e8ffb
commit acad50ae5f
2 changed files with 6 additions and 8 deletions

View File

@ -1,6 +1,5 @@
-- Parameters
local END_DEPTH = mcl_vars.mg_end_min
local TCAVE = 0.6
local nobj_cave = nil
-- 3D noise
@ -118,7 +117,7 @@ local function build_end_portal(pos, target3)
end
local function find_end_target3_y2(target3_x, target3_z)
local start_y = END_DEPTH + math.random(20, 120) -- Search start
local start_y = mcl_vars.mg_end_min + math.random(20, 120) -- Search start
if not nobj_cave then
nobj_cave = minetest.get_perlin(np_cave)
end
@ -229,8 +228,8 @@ local function make_end_portal(pos)
local target3 = {x = p1.x, y = p1.y, z = p1.z}
target3.x = target3.x + 1
if target3.y < END_DEPTH then
target3.y = math.random(-52, 100)
if target3.y < mcl_vars.mg_end_max and target3.y > mcl_vars.mg_end_min then
target3.y = math.random(mcl_vars.mg_overworld_min + 40, mcl_vars.mg_overworld_min + 96)
else
target3.y = find_end_target3_y2(target3.x, target3.z)
end

View File

@ -1,6 +1,5 @@
-- Parameters
local NETHER_DEPTH = mcl_vars.mg_nether_min
local TCAVE = 0.6
local nobj_cave = nil
@ -117,7 +116,7 @@ local function build_portal(pos, target)
end
local function find_nether_target_y(target_x, target_z)
local start_y = NETHER_DEPTH + math.random(38, 117) -- Search start
local start_y = mcl_vars.mg_nether_min + math.random(38, 117) -- Search start
if not nobj_cave then
nobj_cave = minetest.get_perlin(np_cave)
end
@ -228,8 +227,8 @@ local function make_portal(pos)
local target = {x = p1.x, y = p1.y, z = p1.z}
target.x = target.x + 1
if target.y < NETHER_DEPTH then
target.y = math.random(-52, 100)
if target.y < mcl_vars.mg_nether_max and target.y > mcl_vars.mg_nether_min then
target.y = math.random(mcl_vars.mg_overworld_min + 40, mcl_vars.mg_overworld_min + 96)
else
target.y = find_nether_target_y(target.x, target.z)
end