mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-22 07:59:32 +01:00
Rename mapgen variables
This commit is contained in:
parent
19150ddddb
commit
2495676e54
5 changed files with 27 additions and 19 deletions
|
@ -8,21 +8,29 @@ mcl_vars.gui_bg_img = ""
|
|||
|
||||
mcl_vars.inventory_header = mcl_vars.gui_slots .. mcl_vars.gui_bg
|
||||
|
||||
-- Mapgen variables
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
local minecraft_height_limit = 256
|
||||
if mg_name ~= "flat" then
|
||||
mcl_vars.mg_overworld_min = -62
|
||||
mcl_vars.mg_overworld_max = mcl_vars.mg_overworld_min + minecraft_height_limit
|
||||
|
||||
-- 1 flat bedrock layer with 4 rough layers above
|
||||
mcl_vars.bedrock_overworld_min = -62
|
||||
mcl_vars.bedrock_overworld_max = mcl_vars.bedrock_overworld_min + 4
|
||||
mcl_vars.bedrock_is_rough = true
|
||||
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_bedrock_is_rough = true
|
||||
else
|
||||
-- 1 perfectly flat bedrock layer
|
||||
local ground = minetest.get_mapgen_setting("mgflat_ground_level")
|
||||
if not ground then
|
||||
ground = 8
|
||||
end
|
||||
mcl_vars.bedrock_overworld_min = ground - 3
|
||||
mcl_vars.bedrock_overworld_max = mcl_vars.bedrock_overworld_min
|
||||
mcl_vars.bedrock_is_rough = false
|
||||
mcl_vars.mg_overworld_min = ground - 1
|
||||
mcl_vars.mg_overworld_max = mcl_vars.mg_overworld_min + minecraft_height_limit
|
||||
|
||||
-- 1 perfectly flat bedrock layer
|
||||
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_bedrock_is_rough = false
|
||||
end
|
||||
|
||||
-- Set default stack sizes
|
||||
|
|
|
@ -200,8 +200,8 @@ end
|
|||
-- 2nd return value: true if it is in the deadly part of the void
|
||||
function mcl_util.is_in_void(pos)
|
||||
local void, void_deadly
|
||||
void = pos.y < mcl_vars.bedrock_overworld_min
|
||||
void_deadly = pos.y < mcl_vars.bedrock_overworld_min - 65
|
||||
void = pos.y < mcl_vars.mg_overworld_min
|
||||
void_deadly = pos.y < mcl_vars.mg_overworld_min - 64
|
||||
return void, void_deadly
|
||||
end
|
||||
|
||||
|
@ -213,8 +213,8 @@ end
|
|||
-- If the Y coordinate is not located in any dimension, it will return:
|
||||
-- nil, "void"
|
||||
function mcl_util.y_to_layer(y)
|
||||
if y >= mcl_vars.bedrock_overworld_min then
|
||||
return y - mcl_vars.bedrock_overworld_min, "overworld"
|
||||
if y >= mcl_vars.mg_overworld_min then
|
||||
return y - mcl_vars.mg_overworld_min, "overworld"
|
||||
else
|
||||
return nil, "void"
|
||||
end
|
||||
|
@ -226,5 +226,5 @@ end
|
|||
-- minecraft_dimension parameter is ignored at the moment
|
||||
-- TODO: Implement dimensions
|
||||
function mcl_util.layer_to_y(layer, minecraft_dimension)
|
||||
return layer + mcl_vars.bedrock_overworld_min
|
||||
return layer + mcl_vars.mg_overworld_min
|
||||
end
|
||||
|
|
|
@ -74,7 +74,7 @@ skycolor = {
|
|||
players = skycolor.utils.get_players(players)
|
||||
for _, player in ipairs(players) do
|
||||
local pos = player:getpos()
|
||||
if pos.y >= mcl_vars.bedrock_overworld_max then
|
||||
if pos.y >= mcl_vars.mg_bedrock_overworld_max then
|
||||
player:set_sky(color, "plain", nil)
|
||||
end
|
||||
end
|
||||
|
@ -112,7 +112,7 @@ skycolor = {
|
|||
local players = skycolor.utils.get_players(nil)
|
||||
for _, player in ipairs(players) do
|
||||
local pos = player:getpos()
|
||||
if pos.y >= mcl_vars.bedrock_overworld_max then
|
||||
if pos.y >= mcl_vars.mg_bedrock_overworld_max then
|
||||
player:set_sky(color, "plain", nil)
|
||||
end
|
||||
end
|
||||
|
@ -125,7 +125,7 @@ skycolor = {
|
|||
local players = skycolor.utils.get_players(players)
|
||||
for _, player in ipairs(players) do
|
||||
local pos = player:getpos()
|
||||
if pos.y >= mcl_vars.bedrock_overworld_max then
|
||||
if pos.y >= mcl_vars.mg_bedrock_overworld_max then
|
||||
player:set_sky(nil, "regular", nil)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -563,8 +563,8 @@ end)
|
|||
|
||||
|
||||
-- Generate bedrock layer or layers
|
||||
local BEDROCK_MIN = mcl_vars.bedrock_overworld_min
|
||||
local BEDROCK_MAX = mcl_vars.bedrock_overworld_max
|
||||
local BEDROCK_MIN = mcl_vars.mg_bedrock_overworld_min
|
||||
local BEDROCK_MAX = mcl_vars.mg_bedrock_overworld_max
|
||||
|
||||
-- Below the bedrock, generate air/void
|
||||
|
||||
|
@ -581,7 +581,7 @@ minetest.register_on_generated(function(minp, maxp)
|
|||
for z = minp.z, maxp.z do
|
||||
local p_pos = area:index(x, y, z)
|
||||
local setdata = nil
|
||||
if mcl_vars.bedrock_is_rough then
|
||||
if mcl_vars.mg_bedrock_is_rough then
|
||||
-- Bedrock layers with increasing levels of roughness, until a perfecly flat bedrock later at the bottom layer
|
||||
-- This code assumes a bedrock height of 5 layers.
|
||||
if y == BEDROCK_MAX then
|
||||
|
|
|
@ -122,7 +122,7 @@ minetest.register_globalstep(function(dtime)
|
|||
end
|
||||
|
||||
-- Apply black sky in the Void and deal Void damage
|
||||
if pos.y < mcl_vars.bedrock_overworld_max then
|
||||
if pos.y < mcl_vars.mg_bedrock_overworld_max then
|
||||
-- Player reached the void, set black sky box
|
||||
player:set_sky("#000000", "plain")
|
||||
-- FIXME: Sky handling in MCL2 is held together with lots of duct tape.
|
||||
|
|
Loading…
Reference in a new issue