diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index 62100c627..a16f1c23d 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -287,6 +287,7 @@ function mcl_mobs.register_mob(name, def) spawn_in_group_min = def.spawn_in_group_min, noyaw = def.noyaw or false, particlespawners = def.particlespawners, + spawn_check = def.spawn_check, -- End of MCL2 extensions on_spawn = def.on_spawn, on_blast = def.on_blast or function(self,damage) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 82870dcd3..9c51c0f86 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -742,11 +742,15 @@ local function spawn_check(pos, spawn_def) end elseif dimension == "overworld" then if mob_type == "monster" then - if 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 art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then return true end else - if gotten_light > overworld_passive_threshold then + 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 return true end end diff --git a/mods/ENTITIES/mobs_mc/bat.lua b/mods/ENTITIES/mobs_mc/bat.lua index b5532e2ee..b8b650877 100644 --- a/mods/ENTITIES/mobs_mc/bat.lua +++ b/mods/ENTITIES/mobs_mc/bat.lua @@ -2,6 +2,18 @@ local S = minetest.get_translator("mobs_mc") +local function spawn_check(pos, environmental_light, artificial_light, sky_light) + local date = os.date("*t") + local maxlight + if (date.month == 10 and date.day >= 20) or (date.month == 11 and date.day <= 3) then + maxlight = 6 + else + maxlight = 3 + end + + return artificial_light <= maxlight +end + mcl_mobs.register_mob("mobs_mc:bat", { description = S("Bat"), type = "animal", @@ -50,6 +62,7 @@ mcl_mobs.register_mob("mobs_mc:bat", { jump = false, fly = true, makes_footstep_sound = false, + spawn_check = spawn_check, }) diff --git a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua index c07afb6b1..9cc5191bc 100644 --- a/mods/ENTITIES/mobs_mc/slime+magma_cube.lua +++ b/mods/ENTITIES/mobs_mc/slime+magma_cube.lua @@ -161,6 +161,16 @@ local spawn_children_on_die = function(child_mob, spawn_distance, eject_speed) end end +local function slime_spawn_check(pos, environmental_light, artificial_light, sky_light) + local maxlight = swamp_light_max + + if is_slime_chunk(pos) then + maxlight = minetest.LIGHT_MAX + 1 + end + + return artificial_light <= maxlight +end + -- Slime local slime_big = { description = S("Slime"), @@ -213,6 +223,7 @@ local slime_big = { spawn_small_alternative = "mobs_mc:slime_small", on_die = spawn_children_on_die("mobs_mc:slime_small", 1.0, 1.5), use_texture_alpha = true, + spawn_check = slime_spawn_check, } mcl_mobs.register_mob("mobs_mc:slime_big", slime_big)