From acad50ae5ff147db0b1c511dd44ebd043be9afaf Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 17 Aug 2017 01:58:17 +0200 Subject: [PATCH] Allow to teleport back to overworld --- mods/MAPGEN/mcl_portals/portal_end.lua | 7 +++---- mods/MAPGEN/mcl_portals/portal_nether.lua | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mods/MAPGEN/mcl_portals/portal_end.lua b/mods/MAPGEN/mcl_portals/portal_end.lua index d9cc1b64db..c476890b2d 100644 --- a/mods/MAPGEN/mcl_portals/portal_end.lua +++ b/mods/MAPGEN/mcl_portals/portal_end.lua @@ -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 diff --git a/mods/MAPGEN/mcl_portals/portal_nether.lua b/mods/MAPGEN/mcl_portals/portal_nether.lua index 21526e2e01..bf96af8741 100644 --- a/mods/MAPGEN/mcl_portals/portal_nether.lua +++ b/mods/MAPGEN/mcl_portals/portal_nether.lua @@ -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