Add a function to control spawning.

pull/4/head
C Nelson 2013-06-07 20:34:34 -05:00
parent b254ecd9fc
commit ecefb2534b
1 changed files with 4 additions and 1 deletions

View File

@ -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))