mirror of
https://github.com/Poikilos/mobs.git
synced 2023-10-03 07:28:50 -07:00
Add a function to control spawning.
This commit is contained in:
parent
b254ecd9fc
commit
ecefb2534b
5
api.lua
5
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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user