[mapgen] Use more readable constants, increase max_block_generate_distance

This commit is contained in:
kay27 2021-04-29 00:53:48 +04:00
parent c23bb1d59d
commit 3c5bf8c9b2
12 changed files with 113 additions and 105 deletions

View file

@ -27,6 +27,8 @@ movement_gravity = 10.4
# Mapgen stuff
max_block_generate_distance = 13
# altitude_chill and altitude_dry doesn't go well together with MCL2 biomes
# which already include "snowed" variants as you go higher.
# humid_rivers would cause the MushroomIsland biome to appear frequently around rivers.

View file

@ -1,10 +1,7 @@
mcl_mapgen = {}
mcl_mapgen.overworld = {}
mcl_mapgen.nether = {}
mcl_mapgen.end = {}
local minetest_log, math_floor = minetest.log, math.floor
local minetest_get_node = minetest.get_node
local minetest_get_node, minetest_get_voxel_manip = minetest.get_node, minetest.get_voxel_manip
-- Calculate mapgen_edge_min/mapgen_edge_max
mcl_mapgen.CS = math.max(1, tonumber(minetest.get_mapgen_setting("chunksize")) or 5)
@ -88,14 +85,14 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
vm_context.data = data
area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
vm_context.area = area
for _, v in pairs(lvm_chunk_queue) do
vm_context = v.f(vm_context)
end
end
local chunk_is_ready = true
if block > 0 then
local x0, y0, z0 = minp.x, minp.y, minp.z
local bx0, by0, bz0 = math_floor(x0/BS), math_floor(y0/BS), math_floor(z0/BS)
local bx1, by1, bz1 = bx0 + LAST_BLOCK, by0 + LAST_BLOCK, bz0 + LAST_BLOCK -- only for entire chunk check
local x1, y1, z1, x2, y2, z2 = emin.x, emin.y, emin.z, emax.x, emax.y, emax.z
local x, y, z = x1, y1, z1 -- iterate 7x7x7 mapchunk, {x,y,z} - first node pos. of mapblock
local bx, by, bz -- block coords (in blocs)
@ -133,6 +130,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end
else
blocks[bx][by][bz] = current_mapgen_block_writes
chunk_is_ready = chunk_is_ready and (bx < bx0 or bx > bx1 or by < by0 or by > by1 or bz < bz0 or bz > bz1)
end
z = z + BS
end
@ -147,6 +145,11 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end
if lvm > 0 then
if chunk_is_ready then
for _, v in pairs(lvm_chunk_queue) do
vm_context = v.f(vm_context)
end
end
if vm_context.write then
vm:set_data(data)
end
@ -158,8 +161,10 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
vm:update_liquids()
end
for _, v in pairs(node_chunk_queue) do
v.f(minp, maxp, blockseed)
if chunk_is_ready then
for _, v in pairs(node_chunk_queue) do
v.f(minp, maxp, blockseed)
end
end
for i, b in pairs(current_blocks) do
@ -218,13 +223,16 @@ end
-- Mapgen variables
local overworld, end_, nether = {}, {}, {}
mcl_mapgen.seed = minetest.get_mapgen_setting("seed")
mcl_mapgen.name = minetest.get_mapgen_setting("mg_name")
mcl_mapgen.v6 = mcl_mapgen.name == "v6"
mcl_mapgen.superflat = mcl_mapgen.name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true"
mcl_mapgen.singlenode = mcl_mapgen.name == "singlenode"
mcl_mapgen.normal = not mcl_mapgen.superflat and not mcl_mapgen.singlenode
local superflat, singlenode, normal = mcl_mapgen.superflat, mcl_mapgen.singlenode, mcl_mapgen.normal
minetest_log("action", "[mcl_mapgen] Mapgen mode: " .. normal and "normal" or (superflat and "superflat" or "singlenode"))
minetest_log("action", "[mcl_mapgen] Mapgen mode: " .. (normal and "normal" or (superflat and "superflat" or "singlenode")))
mcl_mapgen.minecraft_height_limit = 256
@ -241,55 +249,58 @@ mcl_mapgen.bedrock_is_rough = normal
]]
-- Overworld
mcl_mapgen.overworld.min = -62
overworld.min = -62
if superflat then
mcl_mapgen.ground = tonumber(minetest.get_mapgen_setting("mgflat_ground_level")) or 8
mcl_mapgen.overworld.min = ground - 3
overworld.min = ground - 3
end
-- if singlenode then mcl_mapgen.overworld.min = -66 end -- DONT KNOW WHY
mcl_mapgen.overworld.max = mcl_mapgen.EDGE_MAX
overworld.max = mcl_mapgen.EDGE_MAX
mcl_mapgen.overworld.bedrock_min = mcl_mapgen.overworld.min
mcl_mapgen.overworld.bedrock_max = mcl_mapgen.overworld.bedrock_min + (mcl_mapgen.bedrock_is_rough and 4 or 0)
overworld.bedrock_min = overworld.min
overworld.bedrock_max = overworld.bedrock_min + (mcl_mapgen.bedrock_is_rough and 4 or 0)
mcl_mapgen.lava = normal
mcl_mapgen.lava_overworld_max = mcl_mapgen.overworld.min + (normal and 10 or 0)
overworld.lava_max = overworld.min + (normal and 10 or 0)
-- The Nether (around Y = -29000)
mcl_mapgen.nether.min = -29067 -- Carefully chosen to be at a mapchunk border
mcl_mapgen.nether.max = mcl_mapgen.nether.min + 128
mcl_mapgen.nether.bedrock_bottom_min = mcl_mapgen.nether.min
mcl_mapgen.nether.bedrock_top_max = mcl_mapgen.nether.max
nether.min = -29067 -- Carefully chosen to be at a mapchunk border
nether.max = nether.min + 128
nether.bedrock_bottom_min = nether.min
nether.bedrock_top_max = nether.max
if not superflat then
mcl_mapgen.nether.bedrock_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min + 4
mcl_mapgen.nether.bedrock_top_min = mcl_vars.mg_bedrock_nether_top_max - 4
mcl_mapgen.nether.lava_max = mcl_mapgen.nether.min + 31
nether.bedrock_bottom_max = nether.bedrock_bottom_min + 4
nether.bedrock_top_min = nether.bedrock_top_max - 4
nether.lava_max = nether.min + 31
else
-- Thin bedrock in classic superflat mapgen
mcl_mapgen.nether.bedrock_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min
mcl_mapgen.nether.bedrock_top_min = mcl_vars.mg_bedrock_nether_top_max
mcl_mapgen.nether.lava_max = mcl_mapgen.nether.min + 2
nether.bedrock_bottom_max = nether.bedrock_bottom_min
nether.bedrock_top_min = nether.bedrock_top_max
nether.lava_max = nether.min + 2
end
if mcl_mapgen.name == "flat" then
if superflat then
mcl_mapgen.nether.flat_nether_floor = mcl_mapgen.nether.bedrock_nether_bottom_max + 4
mcl_mapgen.nether.flat_nether_ceiling = mcl_mapgen.nether.bedrock_nether_bottom_max + 52
nether.flat_nether_floor = nether.bedrock_bottom_max + 4
nether.flat_nether_ceiling = nether.bedrock_bottom_max + 52
else
mcl_mapgen.nether.flat_nether_floor = mcl_mapgen.nether.lava_nether_max + 4
mcl_mapgen.nether.flat_nether_ceiling = mcl_mapgen.nether.lava_nether_max + 52
nether.flat_nether_floor = nether.lava_max + 4
nether.flat_nether_ceiling = nether.lava_max + 52
end
end
-- The End (surface at ca. Y = -27000)
mcl_mapgen.end.min = -27073 -- Carefully chosen to be at a mapchunk border
mcl_mapgen.end.max_official = mcl_mapgen.end.min + mcl_mapgen.minecraft_height_limit
mcl_mapgen.end.max = mcl_mapgen.overworld.min - 2000
mcl_vars.mg_end_platform_pos = { x = 100, y = mcl_mapgen.end.min + 74, z = 0 }
end_.min = -27073 -- Carefully chosen to be at a mapchunk border
end_.max = overworld.min - 2000
end_.platform_pos = { x = 100, y = end_.min + 74, z = 0 }
-- Realm barrier used to safely separate the End from the void below the Overworld
mcl_vars.mg_realm_barrier_overworld_end_max = mcl_mapgen.end.max
mcl_vars.mg_realm_barrier_overworld_end_min = mcl_mapgen.end.max - 11
mcl_mapgen.realm_barrier_overworld_end_max = end_.max
mcl_mapgen.realm_barrier_overworld_end_min = end_.max - 11
-- Use MineClone 2-style dungeons
mcl_vars.mg_dungeons = true
-- Use MineClone 2-style dungeons for normal mapgen
mcl_mapgen.dungeons = normal
mcl_mapgen.overworld = overworld
mcl_mapgen.end_ = end_
mcl_mapgen.nether = nether

View file

@ -3,8 +3,8 @@ mcl_worlds = {}
-- For a given position, returns a 2-tuple:
-- 1st return value: true if pos is in void
-- 2nd return value: true if it is in the deadly part of the void
local min1, min2, min3 = mcl_mapgen.overworld.min, mcl_mapgen.end.min, mcl_mapgen.nether.min
local max1, max2, max3 = mcl_mapgen.overworld.max, mcl_mapgen.end.max, mcl_mapgen.nether.max+128
local min1, min2, min3 = mcl_mapgen.overworld.min, mcl_mapgen.end_.min, mcl_mapgen.nether.min
local max1, max2, max3 = mcl_mapgen.overworld.max, mcl_mapgen.end_.max, mcl_mapgen.nether.max+128
function mcl_worlds.is_in_void(pos)
local y = pos.y
local void = not ((y < max1 and y > min1) or (y < max2 and y > min2) or (y < max3 and y > min3))
@ -13,7 +13,7 @@ function mcl_worlds.is_in_void(pos)
local deadly_tolerance = 64 -- the player must be this many nodes “deep” into the void to be damaged
if void then
-- Overworld → Void → End → Void → Nether → Void
if y < mcl_vars.min1 and y > max2 then
if y < min1 and y > max2 then
void_deadly = y < min1 - deadly_tolerance
elseif y < min2 and y > max3 then
-- The void between End and Nether. Like usual, but here, the void
@ -56,24 +56,24 @@ end
-- mc_dimension is one of "overworld", "nether", "end" (default: "overworld").
function mcl_worlds.layer_to_y(layer, mc_dimension)
if mc_dimension == "overworld" or mc_dimension == nil then
return layer + mcl_vars.mg_overworld_min
return layer + min1
elseif mc_dimension == "nether" then
return layer + mcl_vars.mg_nether_min
return layer + min3
elseif mc_dimension == "end" then
return layer + mcl_vars.mg_end_min
return layer + min2
end
end
-- Takes a position and returns true if this position can have weather
function mcl_worlds.has_weather(pos)
-- Weather in the Overworld and the high part of the void below
return pos.y <= mcl_vars.mg_overworld_max and pos.y >= mcl_vars.mg_overworld_min - 64
return pos.y <= max1 and pos.y >= min1 - 64
end
-- Takes a position and returns true if this position can have Nether dust
function mcl_worlds.has_dust(pos)
-- Weather in the Overworld and the high part of the void below
return pos.y <= mcl_vars.mg_nether_max + 138 and pos.y >= mcl_vars.mg_nether_min - 10
return pos.y <= max3 + 138 and pos.y >= min3 - 10
end
-- Takes a position (pos) and returns true if compasses are working here
@ -83,7 +83,7 @@ function mcl_worlds.compass_works(pos)
if dim == "nether" or dim == "end" then
return false
elseif dim == "void" then
return pos.y <= mcl_vars.mg_overworld_max and pos.y >= mcl_vars.mg_overworld_min - 64
return pos.y <= max1 and pos.y >= min1 - 64
else
return true
end

View file

@ -1,5 +1,4 @@
name = mcl_worlds
author = Wuzzy
description = Utility functions for worlds and the “dimensions”.
depends = mcl_init
depends = mcl_mapgen

View file

@ -241,7 +241,7 @@ mobs_mc.override.spawn_height = {
nether_max = mcl_mapgen.nether.max,
-- End boundaries (inclusive)
end_min = mcl_mapgen.end.min,
end_max = mcl_mapgen.end.max,
end_min = mcl_mapgen.end_.min,
end_max = mcl_mapgen.end_.max,
}

View file

@ -1,10 +1,10 @@
local S = minetest.get_translator("mcl_portals")
-- Parameters
local SPAWN_MIN = mcl_vars.mg_end_min+70
local SPAWN_MAX = mcl_vars.mg_end_min+98
local SPAWN_MIN = mcl_mapgen.end_.min+70
local SPAWN_MAX = mcl_mapgen.end_.min+98
local mg_name = minetest.get_mapgen_setting("mg_name")
local mg_name = mcl_mapgen.name
local destroy_portal = function(pos)
local neighbors = {
@ -178,7 +178,7 @@ function mcl_portals.end_teleport(obj, pos)
-- Teleport to the End at a fixed position and generate a
-- 5×5 obsidian platform below.
local platform_pos = mcl_vars.mg_end_platform_pos
local platform_pos = mcl_mapgen.end_.platform_pos
-- force emerge of target1 area
minetest.get_voxel_manip():read_from_map(platform_pos, platform_pos)
if not minetest.get_node_or_nil(platform_pos) then

View file

@ -28,7 +28,7 @@ local DISTANCE_MAX = 128
local PORTAL = "mcl_portals:portal"
local OBSIDIAN = "mcl_core:obsidian"
local O_Y_MIN, O_Y_MAX = max(mcl_mapgen.overworld.min, -31), min(mcl_mapgen.overworld.max, 2048)
local N_Y_MIN, N_Y_MAX = mcl_vars.mg_bedrock_nether_bottom_min, mcl_vars.mg_bedrock_nether_top_min - H_MIN
local N_Y_MIN, N_Y_MAX = mcl_mapgen.nether.bedrock_bottom_min, mcl_mapgen.nether.bedrock_top_min - H_MIN
-- Alpha and particles
local node_particles_allowed = minetest.settings:get("mcl_node_particles") or "none"

View file

@ -1,8 +1,7 @@
local mg_name = minetest.get_mapgen_setting("mg_name")
local mg_seed = minetest.get_mapgen_setting("seed")
local mg_seed = mcl_mapgen.seed
-- Some mapgen settings
local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true"
local superflat = mcl_mapgen.superflat
local generate_fallen_logs = minetest.settings:get_bool("mcl_generate_fallen_logs", false)
@ -1505,8 +1504,8 @@ local function register_dimension_biomes()
node_cave_liquid = "air",
-- FIXME: For some reason the End stops generating early if this constant is not added.
-- Figure out why.
y_min = mcl_mapgen.end.min,
y_max = mcl_mapgen.end.max + 80,
y_min = mcl_mapgen.end_.min,
y_max = mcl_mapgen.end_.max + 80,
heat_point = 50,
humidity_point = 50,
_mcl_biome_type = "medium",
@ -1539,7 +1538,7 @@ local function register_biome_ores()
-- Rarely replace stone with stone monster eggs.
-- In v6 this can happen anywhere, in other mapgens only in Extreme Hills.
local monster_egg_scarcity
if mg_name == "v6" then
if mcl_mapgen.v6 then
monster_egg_scarcity = 28 * 28 * 28
else
monster_egg_scarcity = 26 * 26 * 26
@ -1561,7 +1560,7 @@ local function register_biome_ores()
})
-- Bonus gold spawn in Mesa
if mg_name ~= "v6" then
if not mcl_mapgen.v6 then
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_gold",
@ -2009,7 +2008,7 @@ local function register_dimension_ores()
wherein = {"mcl_nether:netherrack", "mcl_core:stone"},
clust_scarcity = 26 * 26 * 26,
clust_size = 5,
y_min = mcl_vars.mg_lava_nether_max + 10,
y_min = mcl_mapgen.nether.lava_max + 10,
y_max = mcl_mapgen.nether.max,
noise_threshold = 0.0,
noise_params = {
@ -2077,7 +2076,7 @@ local function register_dimension_ores()
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_mapgen.nether.min,
y_max = mcl_vars.mg_lava_nether_max + 1,
y_max = mcl_mapgen.nether.lava_max + 1,
})
minetest.register_ore({
@ -2087,8 +2086,8 @@ local function register_dimension_ores()
clust_scarcity = 1000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_vars.mg_lava_nether_max + 2,
y_max = mcl_vars.mg_lava_nether_max + 12,
y_min = mcl_mapgen.nether.lava_max + 2,
y_max = mcl_mapgen.nether.lava_max + 12,
})
minetest.register_ore({
@ -2098,8 +2097,8 @@ local function register_dimension_ores()
clust_scarcity = 2000,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_vars.mg_lava_nether_max + 13,
y_max = mcl_vars.mg_lava_nether_max + 48,
y_min = mcl_mapgen.nether.lava_max + 13,
y_max = mcl_mapgen.nether.lava_max + 48,
})
minetest.register_ore({
ore_type = "scatter",
@ -2108,7 +2107,7 @@ local function register_dimension_ores()
clust_scarcity = 3500,
clust_num_ores = 1,
clust_size = 1,
y_min = mcl_vars.mg_lava_nether_max + 49,
y_min = mcl_mapgen.nether.lava_max + 49,
y_max = mcl_mapgen.nether.max,
})
@ -2119,7 +2118,7 @@ local function register_dimension_ores()
-- FIXME: Broken lighting in v6 mapgen
local end_wherein
if mg_name == "v6" then
if mcl_mapgen.v6 then
end_wherein = {"air", "mcl_core:stone"}
else
end_wherein = {"air"}
@ -2129,11 +2128,11 @@ local function register_dimension_ores()
ore_type = "stratum",
ore = "mcl_end:end_stone",
wherein = end_wherein,
y_min = mcl_mapgen.end.min+64,
y_max = mcl_mapgen.end.min+80,
y_min = mcl_mapgen.end_.min+64,
y_max = mcl_mapgen.end_.min+80,
noise_params = {
offset = mcl_mapgen.end.min+70,
offset = mcl_mapgen.end_.min+70,
scale = -1,
spread = {x=126, y=126, z=126},
seed = mg_seed+9999,
@ -2156,11 +2155,11 @@ local function register_dimension_ores()
ore_type = "stratum",
ore = "mcl_end:end_stone",
wherein = end_wherein,
y_min = mcl_mapgen.end.min+64,
y_max = mcl_mapgen.end.min+80,
y_min = mcl_mapgen.end_.min+64,
y_max = mcl_mapgen.end_.min+80,
noise_params = {
offset = mcl_mapgen.end.min+72,
offset = mcl_mapgen.end_.min+72,
scale = -3,
spread = {x=84, y=84, z=84},
seed = mg_seed+999,
@ -2182,11 +2181,11 @@ local function register_dimension_ores()
ore_type = "stratum",
ore = "mcl_end:end_stone",
wherein = end_wherein,
y_min = mcl_mapgen.end.min+64,
y_max = mcl_mapgen.end.min+80,
y_min = mcl_mapgen.end_.min+64,
y_max = mcl_mapgen.end_.min+80,
noise_params = {
offset = mcl_mapgen.end.min+70,
offset = mcl_mapgen.end_.min+70,
scale = -2,
spread = {x=84, y=84, z=84},
seed = mg_seed+99,
@ -3925,8 +3924,8 @@ local function register_dimension_decorations()
octaves = 3,
persist = 0.6
},
y_min = mcl_mapgen.end.min,
y_max = mcl_mapgen.end.max,
y_min = mcl_mapgen.end_.min,
y_max = mcl_mapgen.end_.max,
decoration = "mcl_end:chorus_flower",
height = 1,
biomes = { "End" },
@ -3943,14 +3942,15 @@ end
--
-- Detect mapgen to select functions
--
if mg_name ~= "singlenode" then
if not mcl_mapgen.singlenode then
if not superflat then
if mg_name ~= "v6" then
if not mcl_mapgen.v6 then
register_biomes()
register_biomelike_ores()
end
register_biome_ores()
if mg_name ~= "v6" then
if not mcl_mapgen.v6 then
register_decorations()
end
else

View file

@ -2,10 +2,8 @@
mcl_dungeons = {}
local mg_name = minetest.get_mapgen_setting("mg_name")
-- Are dungeons disabled?
if mcl_vars.mg_dungeons == false or mg_name == "singlenode" then
if mcl_mapgen.dungeons == false or mcl_mapgen.singlenode == true then
return
end
@ -35,7 +33,7 @@ local math_ceil = math.ceil
local get_node = mcl_mapgen.get_far_node
local min_y = math_max(mcl_mapgen.overworld.min, mcl_vars.mg_bedrock_overworld_max) + 1
local min_y = math_max(mcl_mapgen.overworld.min, mcl_mapgen.overworld.bedrock_max) + 1
local max_y = mcl_mapgen.overworld.max - 1
-- Calculate the number of dungeon spawn attempts
-- In Minecraft, there 8 dungeon spawn attempts Minecraft chunk (16*256*16 = 65536 blocks).
@ -358,7 +356,7 @@ local function ecb_spawn_dungeon(blockpos, action, calls_remaining, param)
}
-- Bonus loot for v6 mapgen: Otherwise unobtainable saplings.
if mg_name == "v6" then
if mcl_mapgen.v6 then
table_insert(loottable, {
stacks_min = 1,
stacks_max = 3,

View file

@ -1906,12 +1906,12 @@ local function basic(c)
-- The Air on the Nether roof, https://git.minetest.land/MineClone2/MineClone2/issues/1186
lvm_used = set_layers(data, area, c_air , nil, mcl_mapgen.nether.max +1, mcl_mapgen.nether.max + 128 , minp, maxp, lvm_used, pr)
-- The Void above the Nether below the End:
lvm_used = set_layers(data, area, c_void , nil, mcl_mapgen.nether.max + 128 +1, mcl_mapgen.end.min -1, minp, maxp, lvm_used, pr)
lvm_used = set_layers(data, area, c_void , nil, mcl_mapgen.nether.max + 128 +1, mcl_mapgen.end_.min -1, minp, maxp, lvm_used, pr)
-- [[ THE END: mcl_mapgen.end.min mcl_mapgen.end.max ]]
-- [[ THE END: mcl_mapgen.end_.min mcl_mapgen.end_.max ]]
-- The Void above the End below the Realm barrier:
lvm_used = set_layers(data, area, c_void , nil, mcl_mapgen.end.max +1, mcl_vars.mg_realm_barrier_overworld_end_min-1, minp, maxp, lvm_used, pr)
lvm_used = set_layers(data, area, c_void , nil, mcl_mapgen.end_.max +1, mcl_vars.mg_realm_barrier_overworld_end_min-1, minp, maxp, lvm_used, pr)
-- Realm barrier between the Overworld void and the End
lvm_used = set_layers(data, area, c_realm_barrier, nil, mcl_vars.mg_realm_barrier_overworld_end_min , mcl_vars.mg_realm_barrier_overworld_end_max , minp, maxp, lvm_used, pr)
-- The Void above Realm barrier below the Overworld:
@ -2041,7 +2041,7 @@ local function basic(c)
-- * Replace water with end stone or air (depending on height).
-- * Remove stone, sand, dirt in v6 so our End map generator works in v6.
-- * Generate spawn platform (End portal destination)
elseif minp.y <= mcl_mapgen.end.max and maxp.y >= mcl_mapgen.end.min then
elseif minp.y <= mcl_mapgen.end_.max and maxp.y >= mcl_mapgen.end_.min then
local nodes
if mg_name == "v6" then
nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
@ -2083,11 +2083,11 @@ local function basic(c)
-- Final hackery: Set sun light level in the End.
-- -26912 is at a mapchunk border.
local shadow = true
if minp.y >= -26912 and maxp.y <= mcl_mapgen.end.max then
if minp.y >= -26912 and maxp.y <= mcl_mapgen.end_.max then
vm:set_lighting({day=15, night=15})
lvm_used = true
end
if minp.y >= mcl_mapgen.end.min and maxp.y <= -26911 then
if minp.y >= mcl_mapgen.end_.min and maxp.y <= -26911 then
shadow = false
lvm_used = true
end

View file

@ -18,8 +18,7 @@ local stronghold_rings = {
local strongholds = {}
local strongholds_inited = false
local mg_name = minetest.get_mapgen_setting("mg_name")
local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true"
local superflat = mcl_mapgen.superflat
-- Determine the stronghold positions and store them into the strongholds table.
-- The stronghold positions are based on the world seed.
@ -30,7 +29,7 @@ local init_strongholds = function()
return
end
-- Don't generate strongholds in singlenode
if mg_name == "singlenode" then
if mcl_mapgen.singlenode then
strongholds_inited = true
return
end
@ -47,9 +46,9 @@ local init_strongholds = function()
local dist = pr:next(ring.min, ring.max)
local y
if superflat then
y = mcl_vars.mg_bedrock_overworld_max + 3
y = mcl_mapgen.overworld.bedrock_max + 3
else
y = pr:next(mcl_vars.mg_bedrock_overworld_max+1, mcl_vars.mg_overworld_min+48)
y = pr:next(mcl_mapgen.overworld.bedrock_max+1, mcl_mapgen.overworld.bedrock_min+48)
end
local pos = { x = math.cos(angle) * dist, y = y, z = math.sin(angle) * dist }
pos = vector.round(pos)

View file

@ -16,8 +16,7 @@ end
local probability_railcaves_in_mapchunk = P(0.33333)
setting = tonumber(minetest.settings:get("tsm_railcorridors_probability_railcaves_in_mapchunk"))
-- Extra check to prevent mod griefing in singlenode, mcimported worlds.
local mg_name = minetest.get_mapgen_setting("mg_name")
if mg_name == "singlenode" then
if mcl_mapgen.singlenode then
probability_railcaves_in_mapchunk = P(0)
elseif setting then
probability_railcaves_in_mapchunk = P(setting)
@ -93,10 +92,10 @@ end
-- Max. and min. heights between rail corridors are generated
local height_min
if mcl_vars.mg_lava then
if mcl_mapgen.lava then
height_min = mcl_mapgen.overworld.lava_max + 2
else
height_min = mcl_vars.mg_bedrock_overworld_max + 2
height_min = mcl_mapgen.overworld.bedrock_max + 2
end
local height_max = mcl_worlds.layer_to_y(60)