From 4cf865a36c7110a28513f98c8d87db55c5efa9b2 Mon Sep 17 00:00:00 2001 From: codiac Date: Tue, 28 Nov 2023 02:45:18 +0000 Subject: [PATCH] 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: https://git.minetest.land/MineClone2/MineClone2/pulls/4030 Reviewed-by: the-real-herowl Co-authored-by: codiac Co-committed-by: codiac --- mods/ENTITIES/mcl_mobs/spawning.lua | 33 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 9c51c0f86..885391759 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -732,27 +732,26 @@ 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 dimension == "nether" then - if art_light <= nether_threshold then - return true - end - elseif dimension == "end" then - if art_light <= end_threshold then - 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 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 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 + elseif dimension == "end" then + if art_light <= end_threshold then return true end + elseif dimension == "overworld" then + if art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then + return true + end + end + else + -- passive threshold is apparently the same in all dimensions ... + if gotten_light > overworld_passive_threshold then + return true end end else