Add a table with booleans for each spawing mob that sets whether the mob spawns
parent
aae3120fe7
commit
843009965f
5
api.lua
5
api.lua
|
@ -333,13 +333,18 @@ function mobs:register_mob(name, def)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mobs.spawning_mobs = {}
|
||||||
function mobs:register_spawn(name, nodes, max_light, min_light, chance, mobs_per_30_block_radius, max_height)
|
function mobs:register_spawn(name, nodes, max_light, min_light, chance, mobs_per_30_block_radius, max_height)
|
||||||
|
mobs.spawning_mobs[name] = true
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = nodes,
|
nodenames = nodes,
|
||||||
neighbors = nodes,
|
neighbors = nodes,
|
||||||
interval = 30,
|
interval = 30,
|
||||||
chance = chance,
|
chance = chance,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
|
if not mobs.spawning_mobs[name] then
|
||||||
|
return
|
||||||
|
end
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
if not minetest.env:get_node_light(pos) then
|
if not minetest.env:get_node_light(pos) then
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue