Fix light check and limit Y level for slime chunk spawn. (#4139)

Reviewed-on: MineClone2/MineClone2#4139
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: codiac <codiac@inbox.lv>
Co-committed-by: codiac <codiac@inbox.lv>
This commit is contained in:
codiac 2024-01-21 02:52:36 +00:00 committed by the-real-herowl
parent b507838e13
commit d3c591915f
1 changed files with 3 additions and 2 deletions

View File

@ -6,6 +6,7 @@ local MAPBLOCK_SIZE = 16
local seed = minetest.get_mapgen_setting("seed") local seed = minetest.get_mapgen_setting("seed")
local slime_chunk_match local slime_chunk_match
local slime_chunk_spawn_max = mcl_worlds.layer_to_y(40)
local x_modifier local x_modifier
local z_modifier local z_modifier
@ -166,11 +167,11 @@ local swamp_light_max = 7
local function slime_spawn_check(pos, environmental_light, artificial_light, sky_light) local function slime_spawn_check(pos, environmental_light, artificial_light, sky_light)
local maxlight = swamp_light_max local maxlight = swamp_light_max
if is_slime_chunk(pos) then if pos.y <= slime_chunk_spawn_max and is_slime_chunk(pos) then
maxlight = minetest.LIGHT_MAX + 1 maxlight = minetest.LIGHT_MAX + 1
end end
return artificial_light <= maxlight return math.max(artificial_light, sky_light) <= maxlight
end end
-- Slime -- Slime