diff --git a/api.lua b/api.lua index d02fe63..a4b474e 100644 --- a/api.lua +++ b/api.lua @@ -476,7 +476,7 @@ function mobs:register_mob(name, def) end mobs.spawning_mobs = {} -function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height) +function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height, spawn_func) mobs.spawning_mobs[name] = true minetest.register_abm({ nodenames = nodes, @@ -510,6 +510,9 @@ function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_o if minetest.env:get_node(pos).name ~= "air" then return end + if spawn_func and not spawn_func(pos, node) then + return + end if minetest.setting_getbool("display_mob_spawn") then minetest.chat_send_all("[mobs] Add "..name.." at "..minetest.pos_to_string(pos))