forked from MineClone5/MineClone5
91 lines
3.4 KiB
Lua
91 lines
3.4 KiB
Lua
-- Some global variables (don't overwrite them!)
|
|
mcl_vars = {}
|
|
|
|
-- Mapgen variables
|
|
local mg_name = minetest.get_mapgen_setting("mg_name")
|
|
local minecraft_height_limit = 256
|
|
local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true"
|
|
|
|
if not superflat then
|
|
-- Normal mode
|
|
--[[ Realm stacking (h is for height)
|
|
- Overworld (h>=256)
|
|
- Void (h>=1000)
|
|
- Realm Barrier (h=11), to allow escaping the End
|
|
- End (h>=256)
|
|
- Void (h>=1000)
|
|
- Nether (h=128)
|
|
- Void (h>=1000)
|
|
]]
|
|
|
|
-- Overworld
|
|
mcl_vars.mg_overworld_min = -62
|
|
mcl_vars.mg_overworld_max_official = mcl_vars.mg_overworld_min + minecraft_height_limit
|
|
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
|
|
mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min + 4
|
|
mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min + 10
|
|
mcl_vars.mg_lava = true
|
|
mcl_vars.mg_bedrock_is_rough = true
|
|
|
|
else
|
|
-- Classic superflat
|
|
local ground = minetest.get_mapgen_setting("mgflat_ground_level")
|
|
ground = tonumber(ground)
|
|
if not ground then
|
|
ground = 8
|
|
end
|
|
mcl_vars.mg_overworld_min = ground - 3
|
|
mcl_vars.mg_overworld_max_official = mcl_vars.mg_overworld_min + minecraft_height_limit
|
|
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
|
|
mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min
|
|
mcl_vars.mg_lava = false
|
|
mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min
|
|
mcl_vars.mg_bedrock_is_rough = false
|
|
end
|
|
|
|
mcl_vars.mg_overworld_max = 31000
|
|
|
|
-- The Nether (around Y = -29000)
|
|
mcl_vars.mg_nether_min = -29067 -- Carefully chosen to be at a mapchunk border
|
|
mcl_vars.mg_nether_max = mcl_vars.mg_nether_min + 128
|
|
mcl_vars.mg_bedrock_nether_bottom_min = mcl_vars.mg_nether_min
|
|
mcl_vars.mg_bedrock_nether_top_max = mcl_vars.mg_nether_max
|
|
if not superflat then
|
|
mcl_vars.mg_bedrock_nether_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min + 4
|
|
mcl_vars.mg_bedrock_nether_top_min = mcl_vars.mg_bedrock_nether_top_max - 4
|
|
mcl_vars.mg_lava_nether_max = mcl_vars.mg_nether_min + 31
|
|
else
|
|
-- Thin bedrock in classic superflat mapgen
|
|
mcl_vars.mg_bedrock_nether_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min
|
|
mcl_vars.mg_bedrock_nether_top_min = mcl_vars.mg_bedrock_nether_top_max
|
|
mcl_vars.mg_lava_nether_max = mcl_vars.mg_nether_min + 2
|
|
end
|
|
if mg_name == "flat" then
|
|
if superflat then
|
|
mcl_vars.mg_flat_nether_floor = mcl_vars.mg_bedrock_nether_bottom_max + 4
|
|
mcl_vars.mg_flat_nether_ceiling = mcl_vars.mg_bedrock_nether_bottom_max + 52
|
|
else
|
|
mcl_vars.mg_flat_nether_floor = mcl_vars.mg_lava_nether_max + 4
|
|
mcl_vars.mg_flat_nether_ceiling = mcl_vars.mg_lava_nether_max + 52
|
|
end
|
|
end
|
|
|
|
-- The End (surface at ca. Y = -27000)
|
|
mcl_vars.mg_end_min = -27073 -- Carefully chosen to be at a mapchunk border
|
|
mcl_vars.mg_end_max_official = mcl_vars.mg_end_min + minecraft_height_limit
|
|
mcl_vars.mg_end_max = mcl_vars.mg_overworld_min - 2000
|
|
mcl_vars.mg_end_platform_pos = { x = 100, y = mcl_vars.mg_end_min + 80, 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_vars.mg_end_max
|
|
mcl_vars.mg_realm_barrier_overworld_end_min = mcl_vars.mg_end_max - 11
|
|
|
|
-- Set default stack sizes
|
|
minetest.nodedef_default.stack_max = 64
|
|
minetest.craftitemdef_default.stack_max = 64
|
|
|
|
-- Set random seed for all other mods (Remember to make sure no other mod calls this function)
|
|
math.randomseed(os.time())
|
|
|
|
|