2017-02-18 01:06:52 +03:00
|
|
|
-- Some global variables (don't overwrite them!)
|
|
|
|
mcl_vars = {}
|
|
|
|
|
2020-11-14 00:59:03 +03:00
|
|
|
mcl_vars.redstone_tick = 0.1
|
|
|
|
|
2019-03-07 15:05:26 +03:00
|
|
|
--- GUI / inventory menu settings
|
2019-03-07 14:42:08 +03:00
|
|
|
mcl_vars.gui_slots = "listcolors[#9990;#FFF7;#FFF0;#000;#FFF]"
|
2019-03-07 15:05:26 +03:00
|
|
|
-- nonbg is added as formspec prepend in mcl_formspec_prepend
|
2020-03-10 07:01:49 +03:00
|
|
|
mcl_vars.gui_nonbg = mcl_vars.gui_slots ..
|
|
|
|
"style_type[image_button;border=false;bgimg=mcl_inventory_button9.png;bgimg_pressed=mcl_inventory_button9_pressed.png;bgimg_middle=2,2]"..
|
|
|
|
"style_type[button;border=false;bgimg=mcl_inventory_button9.png;bgimg_pressed=mcl_inventory_button9_pressed.png;bgimg_middle=2,2]"..
|
|
|
|
"style_type[field;textcolor=#323232]"..
|
|
|
|
"style_type[label;textcolor=#323232]"..
|
|
|
|
"style_type[textarea;textcolor=#323232]"..
|
|
|
|
"style_type[checkbox;textcolor=#323232]"
|
2019-03-07 15:05:26 +03:00
|
|
|
|
|
|
|
-- Background stuff must be manually added by mods (no formspec prepend)
|
2020-03-10 07:01:49 +03:00
|
|
|
mcl_vars.gui_bg_color = "bgcolor[#00000000]"
|
|
|
|
mcl_vars.gui_bg_img = "background9[1,1;1,1;mcl_base_textures_background9.png;true;7]"
|
2019-03-07 14:42:08 +03:00
|
|
|
|
2020-03-10 07:01:49 +03:00
|
|
|
-- Legacy
|
|
|
|
mcl_vars.inventory_header = ""
|
2019-03-07 14:42:08 +03:00
|
|
|
|
2017-03-05 01:00:23 +03:00
|
|
|
-- Mapgen variables
|
2017-02-23 02:15:47 +03:00
|
|
|
local mg_name = minetest.get_mapgen_setting("mg_name")
|
2017-03-05 01:00:23 +03:00
|
|
|
local minecraft_height_limit = 256
|
2019-02-09 04:42:11 +03:00
|
|
|
local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true"
|
|
|
|
|
2020-09-26 01:17:49 +03:00
|
|
|
-- Calculate mapgen_edge_min/mapgen_edge_max
|
|
|
|
mcl_vars.chunksize = math.max(1, tonumber(minetest.get_mapgen_setting("chunksize")) or 5)
|
|
|
|
mcl_vars.MAP_BLOCKSIZE = math.max(1, core.MAP_BLOCKSIZE or 16)
|
|
|
|
mcl_vars.mapgen_limit = math.max(1, tonumber(minetest.get_mapgen_setting("mapgen_limit")) or 31000)
|
|
|
|
mcl_vars.MAX_MAP_GENERATION_LIMIT = math.max(1, core.MAX_MAP_GENERATION_LIMIT or 31000)
|
|
|
|
local central_chunk_offset = -math.floor(mcl_vars.chunksize / 2)
|
|
|
|
local chunk_size_in_nodes = mcl_vars.chunksize * mcl_vars.MAP_BLOCKSIZE
|
|
|
|
local central_chunk_min_pos = central_chunk_offset * mcl_vars.MAP_BLOCKSIZE
|
|
|
|
local central_chunk_max_pos = central_chunk_min_pos + chunk_size_in_nodes - 1
|
|
|
|
local ccfmin = central_chunk_min_pos - mcl_vars.MAP_BLOCKSIZE -- Fullminp/fullmaxp of central chunk, in nodes
|
|
|
|
local ccfmax = central_chunk_max_pos + mcl_vars.MAP_BLOCKSIZE
|
|
|
|
local mapgen_limit_b = math.floor(math.min(mcl_vars.mapgen_limit, mcl_vars.MAX_MAP_GENERATION_LIMIT) / mcl_vars.MAP_BLOCKSIZE)
|
|
|
|
local mapgen_limit_min = -mapgen_limit_b * mcl_vars.MAP_BLOCKSIZE
|
|
|
|
local mapgen_limit_max = (mapgen_limit_b + 1) * mcl_vars.MAP_BLOCKSIZE - 1
|
|
|
|
local numcmin = math.max(math.floor((ccfmin - mapgen_limit_min) / chunk_size_in_nodes), 0) -- Number of complete chunks from central chunk
|
|
|
|
local numcmax = math.max(math.floor((mapgen_limit_max - ccfmax) / chunk_size_in_nodes), 0) -- fullminp/fullmaxp to effective mapgen limits.
|
|
|
|
mcl_vars.mapgen_edge_min = central_chunk_min_pos - numcmin * chunk_size_in_nodes
|
|
|
|
mcl_vars.mapgen_edge_max = central_chunk_max_pos + numcmax * chunk_size_in_nodes
|
|
|
|
|
2019-02-09 04:42:11 +03:00
|
|
|
if not superflat then
|
|
|
|
-- Normal mode
|
2017-08-16 16:29:05 +03:00
|
|
|
--[[ 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)
|
|
|
|
]]
|
2017-03-05 01:00:23 +03:00
|
|
|
|
2017-08-16 16:29:05 +03:00
|
|
|
-- Overworld
|
|
|
|
mcl_vars.mg_overworld_min = -62
|
|
|
|
mcl_vars.mg_overworld_max_official = mcl_vars.mg_overworld_min + minecraft_height_limit
|
2017-03-05 01:00:23 +03:00
|
|
|
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
|
|
|
|
mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min + 4
|
2017-05-20 02:27:09 +03:00
|
|
|
mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min + 10
|
|
|
|
mcl_vars.mg_lava = true
|
2017-03-05 01:00:23 +03:00
|
|
|
mcl_vars.mg_bedrock_is_rough = true
|
2017-08-16 16:29:05 +03:00
|
|
|
|
2017-02-23 02:15:47 +03:00
|
|
|
else
|
2019-02-09 04:42:11 +03:00
|
|
|
-- Classic superflat
|
2017-02-23 02:15:47 +03:00
|
|
|
local ground = minetest.get_mapgen_setting("mgflat_ground_level")
|
2017-07-02 23:35:46 +03:00
|
|
|
ground = tonumber(ground)
|
2017-02-23 03:14:27 +03:00
|
|
|
if not ground then
|
|
|
|
ground = 8
|
|
|
|
end
|
2019-02-09 04:42:11 +03:00
|
|
|
mcl_vars.mg_overworld_min = ground - 3
|
2017-08-16 16:29:05 +03:00
|
|
|
mcl_vars.mg_overworld_max_official = mcl_vars.mg_overworld_min + minecraft_height_limit
|
2017-05-27 17:10:21 +03:00
|
|
|
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
|
2017-03-05 01:00:23 +03:00
|
|
|
mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min
|
2017-05-20 02:27:09 +03:00
|
|
|
mcl_vars.mg_lava = false
|
2017-08-21 18:46:12 +03:00
|
|
|
mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min
|
2017-03-05 01:00:23 +03:00
|
|
|
mcl_vars.mg_bedrock_is_rough = false
|
2017-02-23 02:15:47 +03:00
|
|
|
end
|
2017-02-20 09:10:03 +03:00
|
|
|
|
2017-08-16 19:56:39 +03:00
|
|
|
mcl_vars.mg_overworld_max = 31000
|
2017-08-16 16:29:05 +03:00
|
|
|
|
2017-08-21 18:35:02 +03:00
|
|
|
-- The Nether (around Y = -29000)
|
|
|
|
mcl_vars.mg_nether_min = -29067 -- Carefully chosen to be at a mapchunk border
|
2017-08-16 16:29:05 +03:00
|
|
|
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
|
2019-02-09 04:42:11 +03:00
|
|
|
if not superflat then
|
2017-08-30 02:09:49 +03:00
|
|
|
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
|
2019-02-09 04:42:11 +03:00
|
|
|
mcl_vars.mg_lava_nether_max = mcl_vars.mg_nether_min + 31
|
2017-08-30 02:09:49 +03:00
|
|
|
else
|
2019-02-09 04:42:11 +03:00
|
|
|
-- Thin bedrock in classic superflat mapgen
|
2017-08-30 02:09:49 +03:00
|
|
|
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
|
2019-02-09 04:42:11 +03:00
|
|
|
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
|
2017-08-30 02:09:49 +03:00
|
|
|
end
|
2017-08-16 16:29:05 +03:00
|
|
|
|
2017-08-21 18:35:02 +03:00
|
|
|
-- The End (surface at ca. Y = -27000)
|
|
|
|
mcl_vars.mg_end_min = -27073 -- Carefully chosen to be at a mapchunk border
|
2017-08-16 16:29:05 +03:00
|
|
|
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
|
2019-03-09 21:15:10 +03:00
|
|
|
mcl_vars.mg_end_platform_pos = { x = 100, y = mcl_vars.mg_end_min + 74, z = 0 }
|
2017-11-21 07:39:27 +03:00
|
|
|
|
2017-08-17 20:59:43 +03:00
|
|
|
-- 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
|
2017-08-16 16:29:05 +03:00
|
|
|
|
2020-06-16 03:33:51 +03:00
|
|
|
-- Use MineClone 2-style dungeons
|
|
|
|
mcl_vars.mg_dungeons = true
|
|
|
|
|
2017-02-18 01:06:52 +03:00
|
|
|
-- 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())
|