From bf4c7e1913f632d4fc7637c40fec17e3fb454290 Mon Sep 17 00:00:00 2001 From: codiac Date: Wed, 20 Sep 2023 09:24:51 +1000 Subject: [PATCH] Allow non monsters spawns too --- mods/ENTITIES/mcl_mobs/spawning.lua | 14 +++++++++++--- settingtypes.txt | 7 ++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/spawning.lua b/mods/ENTITIES/mcl_mobs/spawning.lua index 5a07dd55b..82870dcd3 100644 --- a/mods/ENTITIES/mcl_mobs/spawning.lua +++ b/mods/ENTITIES/mcl_mobs/spawning.lua @@ -7,6 +7,7 @@ local nether_threshold = tonumber(minetest.settings:get("mcl_mobs_nether_thresho local end_threshold = tonumber(minetest.settings:get("mcl_mobs_end_threshold")) or 0 local overworld_threshold = tonumber(minetest.settings:get("mcl_mobs_overworld_threshold")) or 0 local overworld_sky_threshold = tonumber(minetest.settings:get("mcl_mobs_overworld_sky_threshold")) or 7 +local overworld_passive_threshold = tonumber(minetest.settings:get("mcl_mobs_overworld_passive_threshold")) or 7 local get_node = minetest.get_node local get_item_group = minetest.get_item_group @@ -724,6 +725,8 @@ local function spawn_check(pos, spawn_def) and (spawn_def.check_position and spawn_def.check_position(pos) or spawn_def.check_position == nil) and ( not spawn_protected or not minetest.is_protected(pos, "") ) then + local gotten_light = get_node_light(pos) + if modern_lighting then local my_node = get_node(pos) local sky_light = minetest.get_natural_light(pos) @@ -738,12 +741,17 @@ local function spawn_check(pos, spawn_def) return true end elseif dimension == "overworld" then - if art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then - return true + if mob_type == "monster" then + if art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then + return true + end + else + if gotten_light > overworld_passive_threshold then + return true + end end end else - local gotten_light = get_node_light(pos) if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then return true end diff --git a/settingtypes.txt b/settingtypes.txt index 827059145..7bac3c0e8 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -178,12 +178,13 @@ mcl_raids_zombie_siege (Zombie siege raid) bool false mcl_mobs_modern_lighting (Use MC 1.18 light rules for spawning) bool true # These only take effect if mcl_mobs_modern_lighting is enabled -# Light levels greater than these block monsters spawning +# Light levels greater than these block mobs spawning # See https://minecraft.fandom.com/wiki/Light#Internal_light_level mcl_mobs_nether_threshold (Artificial light threshold to stop spawns in the Nether) int 11 0 14 mcl_mobs_end_threshold (Artificial light threshold to stop spawns in the End) int 0 0 14 -mcl_mobs_overworld_threshold (Artificial light threshold to stop spawns in the Overworld) int 0 0 14 -mcl_mobs_overworld_sky_threshold (Skylight threshold to stop spawns in the Overworld) int 7 0 14 +mcl_mobs_overworld_threshold (Artificial light threshold to stop monster spawns in the Overworld) int 0 0 14 +mcl_mobs_overworld_sky_threshold (Skylight threshold to stop monster spawns in the Overworld) int 7 0 14 +mcl_mobs_overworld_passive_threshold (Combined light threshold to stop animal and npc spawns in the Overworld) int 7 0 14 [Audio] # Enable flame sound.