delay biome check when spawning

This commit is contained in:
kno10 2024-06-28 12:50:44 +02:00 committed by the-real-herowl
parent 0752ed17d8
commit 382a35bb44

View file

@ -680,6 +680,7 @@ end
--a simple helper function for mob_spawn --a simple helper function for mob_spawn
local function biome_check(biome_list, biome_goal) local function biome_check(biome_list, biome_goal)
if not biome_goal then return false end
for _, data in pairs(biome_list) do for _, data in pairs(biome_list) do
if data == biome_goal then if data == biome_goal then
return true return true
@ -760,9 +761,6 @@ local function spawn_check(pos, spawn_def)
local gotten_node = get_node(pos).name local gotten_node = get_node(pos).name
if not gotten_node then return end if not gotten_node then return end
local biome_name = get_biome_name(pos)
if not biome_name then return end
local is_ground = minetest.get_item_group(gotten_node,"solid") ~= 0 local is_ground = minetest.get_item_group(gotten_node,"solid") ~= 0
if not is_ground then if not is_ground then
pos.y = pos.y - 1 pos.y = pos.y - 1
@ -779,7 +777,7 @@ local function spawn_check(pos, spawn_def)
if pos.y >= spawn_def.min_height if pos.y >= spawn_def.min_height
and pos.y <= spawn_def.max_height and pos.y <= spawn_def.max_height
and spawn_def.dimension == dimension and spawn_def.dimension == dimension
and biome_check(spawn_def.biomes, biome_name) then and biome_check(spawn_def.biomes, get_biome_name(pos)) then
mcl_log("Spawn level 1 check - Passed") mcl_log("Spawn level 1 check - Passed")
if (is_ground or spawn_def.type_of_spawning ~= "ground") if (is_ground or spawn_def.type_of_spawning ~= "ground")