Fix passive threshold in nether and end (#4030)

Fix light check for passive mobs in other dimensions. It is apparently the same in all dimensions. If a mob has it's own spawn_check function then that should be used regardless of it's type.

Fixes #4029

Reviewed-on: MineClone2/MineClone2#4030
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 2023-11-28 02:45:18 +00:00 committed by the-real-herowl
parent b57f6be81d
commit 4cf865a36c
1 changed files with 16 additions and 17 deletions

View File

@ -732,6 +732,9 @@ local function spawn_check(pos, spawn_def)
local sky_light = minetest.get_natural_light(pos)
local art_light = minetest.get_artificial_light(my_node.param1)
if mob_def.spawn_check then
return mob_def.spawn_check(pos, gotten_light, art_light, sky_light)
elseif mob_type == "monster" then
if dimension == "nether" then
if art_light <= nether_threshold then
return true
@ -741,20 +744,16 @@ local function spawn_check(pos, spawn_def)
return true
end
elseif dimension == "overworld" then
if mob_type == "monster" then
if mob_def.spawn_check then
return mob_def.spawn_check(pos, gotten_light, art_light, sky_light)
elseif art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then
if art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then
return true
end
end
else
if mob_def.spawn_check then
return mob_def.spawn_check(pos, gotten_light, art_light, sky_light)
elseif gotten_light > overworld_passive_threshold then
-- passive threshold is apparently the same in all dimensions ...
if gotten_light > overworld_passive_threshold then
return true
end
end
end
else
if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then
return true