Allow non monsters spawns too

This commit is contained in:
codiac 2023-09-20 09:24:51 +10:00
parent 11e3674926
commit bf4c7e1913
2 changed files with 15 additions and 6 deletions

View File

@ -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 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_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_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_node = minetest.get_node
local get_item_group = minetest.get_item_group 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 (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 and ( not spawn_protected or not minetest.is_protected(pos, "") ) then
local gotten_light = get_node_light(pos)
if modern_lighting then if modern_lighting then
local my_node = get_node(pos) local my_node = get_node(pos)
local sky_light = minetest.get_natural_light(pos) local sky_light = minetest.get_natural_light(pos)
@ -738,12 +741,17 @@ local function spawn_check(pos, spawn_def)
return true return true
end end
elseif dimension == "overworld" then elseif dimension == "overworld" then
if mob_type == "monster" then
if 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 return true
end end
else
if gotten_light > overworld_passive_threshold then
return true
end
end
end end
else else
local gotten_light = get_node_light(pos)
if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then
return true return true
end end

View File

@ -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 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 # 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 # 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_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_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_threshold (Artificial light threshold to stop monster 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_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] [Audio]
# Enable flame sound. # Enable flame sound.