forked from VoxeLibre/VoxeLibre
Compare commits
2 Commits
master
...
spawn_ligh
Author | SHA1 | Date |
---|---|---|
codiac | bf4c7e1913 | |
codiac | 11e3674926 |
|
@ -2,6 +2,13 @@
|
|||
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
||||
local mob_class = mcl_mobs.mob_class
|
||||
|
||||
local modern_lighting = minetest.settings:get_bool("mcl_mobs_modern_lighting", true)
|
||||
local nether_threshold = tonumber(minetest.settings:get("mcl_mobs_nether_threshold")) or 11
|
||||
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
|
||||
local get_node_light = minetest.get_node_light
|
||||
|
@ -709,9 +716,6 @@ local function spawn_check(pos, spawn_def)
|
|||
and spawn_def.dimension == dimension
|
||||
and biome_check(spawn_def.biomes, gotten_biome) then
|
||||
|
||||
--mcl_log("Level 1 spawn check passed")
|
||||
--minetest.log("Mob: " .. mob_def.name)
|
||||
|
||||
if (is_ground or spawn_def.type_of_spawning ~= "ground")
|
||||
and (spawn_def.type_of_spawning ~= "ground" or not is_leaf)
|
||||
and (not is_farm_animal(spawn_def.name) or is_grass)
|
||||
|
@ -721,20 +725,38 @@ 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
|
||||
|
||||
--mcl_log("Level 2 spawn check passed")
|
||||
|
||||
local gotten_light = get_node_light(pos)
|
||||
if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then
|
||||
--mcl_log("Level 3 spawn check passed")
|
||||
return true
|
||||
|
||||
if modern_lighting then
|
||||
local my_node = get_node(pos)
|
||||
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 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
|
||||
--mcl_log("Spawn check level 3 failed")
|
||||
if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then
|
||||
return true
|
||||
end
|
||||
end
|
||||
else
|
||||
--mcl_log("Spawn check level 2 failed")
|
||||
end
|
||||
else
|
||||
--mcl_log("Spawn check level 1 failed")
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -173,6 +173,19 @@ mcl_mob_active_range (Active mob range) int 48 0 256
|
|||
# Zombie siege raid (default:false)
|
||||
mcl_raids_zombie_siege (Zombie siege raid) bool false
|
||||
|
||||
# Use MC 1.18 light levels to control monster spawning.
|
||||
# Disable to use older mob specific light levels.
|
||||
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 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 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.
|
||||
flame_sound (Flame sound) bool true
|
||||
|
|
Loading…
Reference in New Issue